Skip to content

Force column order during table creation #2896

Closed Answered by North101
CyMathew asked this question in Q&A
Discussion options

You must be logged in to vote

Would this work?

mixin MetaColumns on Table {
  TextColumn get userId => text()();
  DateTimeColumn get created => dateTime()();
}

mixin ChatEntriesColumns on Table {
  TextColumn get chatId => text()();
  TextColumn get chatText => text()();
  IntColumn get readStatus => integer().withDefault(const Constant(0))();
}

class ChatEntries extends Table with MetaColumns, ChatEntriesColumns {
  @override
  Set<Column<Object>>? get primaryKey => {chatId}
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@CyMathew
Comment options

Answer selected by CyMathew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants