dart-bridge / trestle

Database Gateway and ORM for Dart
MIT License
26 stars 12 forks source link

ORM ignore unique() #6

Closed zakharsk closed 7 years ago

zakharsk commented 7 years ago

Description

This code:

Future createUsersTable() async {
  await gateway.create(users.table, (Schema schema) {
    schema.id();
    schema.timestamps();
    schema.string('uid').unique().nullable(false);
    schema.string('tel').unique().nullable(false);
    schema.string('ls').unique().nullable(false);
    schema.string('password').nullable(false);
    schema.string('city').nullable(false);
  });
}

generate this SQL: CREATE TABLE "users" ("id" SERIAL PRIMARY KEY, "created_at" TIMESTAMP NOT NULL, "updated_at" TIMESTAMP NOT NULL, "uid" VARCHAR(255) NOT NULL, "tel" VARCHAR(255) NOT NULL, "ls" VARCHAR(255) NOT NULL, "password" VARCHAR(255) NOT NULL, "city" VARCHAR(255) NOT NULL);

Enviroment

Server

emilniklas commented 7 years ago

I fixed this and published 0.9.0! Simple bug. Thanks for reporting 🎉