| 1234567891011121314151617181920212223242526272829303132 |
- using InvercargillSql;
- using InvercargillSql.Migrations;
- /**
- * Migration to create the users table with indexes.
- */
- public class V001_CreateUsers : Migration {
- public override string migration_namespace { get { return "app"; } }
- public override uint64 serial { get { return 1; } }
- public override string name { get { return "CreateUsers"; } }
-
- public override void up(MigrationBuilder b) throws SqlError {
- b.create_table("users", t => {
- t.column<int64?>("id")
- .primary_key()
- .auto_increment();
- t.column<string>("name")
- .not_null();
- t.column<string>("email")
- .unique();
- t.column<int64?>("age");
- t.column<bool?>("is_active");
-
- // Create index on email for fast lookups
- t.index("idx_users_email").on_column("email");
- });
- }
-
- public override void down(MigrationBuilder b) throws SqlError {
- b.drop_table("users");
- }
- }
|