drift/examples/migrations_example/lib/tables.drift

18 lines
430 B
Plaintext

import 'tables.dart';
-- This table was added in schema version 3
CREATE TABLE "groups" (
id INTEGER NOT NULL,
title TEXT NOT NULL,
deleted BOOLEAN DEFAULT FALSE,
owner INTEGER NOT NULL REFERENCES users (id),
PRIMARY KEY (id)
);
-- This view was added in schema version 5
CREATE VIEW group_count AS SELECT
users.*,
(SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count
FROM users;