Feat/database view (#1765)

* chore: rename flowy-database to flowy-sqlite

* refactor: rename flowy-grid to flowy-database

* refactor: rename grid to database

* refactor: rename GridEvent to DatabaseEvent

* refactor: rename grid_id to database_id

* refactor: rename dart code
This commit is contained in:
Nathan.fooo
2023-01-31 08:28:31 +08:00
committed by GitHub
parent 5de3912fe3
commit 5b07656295
400 changed files with 2447 additions and 2435 deletions

View File

@ -0,0 +1,5 @@
-- This file should undo anything in `up.sql`
DROP TABLE user_table;
DROP TABLE workspace_table;
DROP TABLE app_table;
DROP TABLE view_table;

View File

@ -0,0 +1,53 @@
-- Your SQL goes here
CREATE TABLE user_table (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL DEFAULT '',
token TEXT NOT NULL DEFAULT '',
email TEXT NOT NULL DEFAULT ''
);
CREATE TABLE workspace_table (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL DEFAULT '',
desc TEXT NOT NULL DEFAULT '',
modified_time BIGINT NOT NULL DEFAULT 0,
create_time BIGINT NOT NULL DEFAULT 0,
user_id TEXT NOT NULL DEFAULT '',
version BIGINT NOT NULL DEFAULT 0
);
CREATE TABLE app_table (
id TEXT NOT NULL PRIMARY KEY,
workspace_id TEXT NOT NULL DEFAULT '',
name TEXT NOT NULL DEFAULT '',
desc TEXT NOT NULL DEFAULT '',
color_style BLOB NOT NULL DEFAULT (x''),
last_view_id TEXT DEFAULT '',
modified_time BIGINT NOT NULL DEFAULT 0,
create_time BIGINT NOT NULL DEFAULT 0,
version BIGINT NOT NULL DEFAULT 0,
is_trash Boolean NOT NULL DEFAULT false
);
CREATE TABLE view_table (
id TEXT NOT NULL PRIMARY KEY,
belong_to_id TEXT NOT NULL DEFAULT '',
name TEXT NOT NULL DEFAULT '',
desc TEXT NOT NULL DEFAULT '',
modified_time BIGINT NOT NULL DEFAULT 0,
create_time BIGINT NOT NULL DEFAULT 0,
thumbnail TEXT NOT NULL DEFAULT '',
view_type INTEGER NOT NULL DEFAULT 0,
version BIGINT NOT NULL DEFAULT 0,
is_trash Boolean NOT NULL DEFAULT false
);
CREATE TABLE trash_table (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL DEFAULT '',
desc TEXT NOT NULL DEFAULT '',
modified_time BIGINT NOT NULL DEFAULT 0,
create_time BIGINT NOT NULL DEFAULT 0,
ty INTEGER NOT NULL DEFAULT 0
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
ALTER TABLE user_table DROP COLUMN workspace;

View File

@ -0,0 +1,2 @@
-- Your SQL goes here
ALTER TABLE user_table ADD COLUMN workspace TEXT NOT NULL DEFAULT '';

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE rev_table;

View File

@ -0,0 +1,10 @@
-- Your SQL goes here
CREATE TABLE rev_table (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
doc_id TEXT NOT NULL DEFAULT '',
base_rev_id BIGINT NOT NULL DEFAULT 0,
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x''),
state INTEGER NOT NULL DEFAULT 0,
ty INTEGER NOT NULL DEFAULT 0
);

View File

@ -0,0 +1,4 @@
-- This file should undo anything in `up.sql`
DROP TABLE kv_table;
DROP TABLE grid_rev_table;
DROP TABLE grid_meta_rev_table;

View File

@ -0,0 +1,22 @@
-- Your SQL goes here
CREATE TABLE kv_table (
key TEXT NOT NULL PRIMARY KEY,
value BLOB NOT NULL DEFAULT (x'')
);
CREATE TABLE grid_rev_table (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
object_id TEXT NOT NULL DEFAULT '',
base_rev_id BIGINT NOT NULL DEFAULT 0,
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x''),
state INTEGER NOT NULL DEFAULT 0
);
CREATE TABLE grid_meta_rev_table (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
object_id TEXT NOT NULL DEFAULT '',
base_rev_id BIGINT NOT NULL DEFAULT 0,
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x''),
state INTEGER NOT NULL DEFAULT 0
);

View File

@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
DROP TABLE grid_block_index_table;
-- DROP TABLE grid_block_fts_table;

View File

@ -0,0 +1,7 @@
-- Your SQL goes here
CREATE TABLE grid_block_index_table (
row_id TEXT NOT NULL PRIMARY KEY,
block_id TEXT NOT NULL
);
-- CREATE VIRTUAL TABLE grid_block_fts_table USING FTS5(content, grid_id, block_id, row_id);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE rev_snapshot;

View File

@ -0,0 +1,7 @@
-- Your SQL goes here
CREATE TABLE rev_snapshot (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
object_id TEXT NOT NULL DEFAULT '',
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x'')
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
ALTER TABLE view_table DROP COLUMN ext_data;

View File

@ -0,0 +1,2 @@
-- Your SQL goes here
ALTER TABLE view_table ADD COLUMN ext_data TEXT NOT NULL DEFAULT '';

View File

@ -0,0 +1 @@
ALTER TABLE user_table DROP COLUMN icon_url;

View File

@ -0,0 +1 @@
ALTER TABLE user_table ADD COLUMN icon_url TEXT NOT NULL DEFAULT '';

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE grid_view_rev_table;

View File

@ -0,0 +1,11 @@
-- Your SQL goes here
CREATE TABLE grid_view_rev_table (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
object_id TEXT NOT NULL DEFAULT '',
base_rev_id BIGINT NOT NULL DEFAULT 0,
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x''),
state INTEGER NOT NULL DEFAULT 0
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE grid_view_rev_table;

View File

@ -0,0 +1,9 @@
-- Your SQL goes here
CREATE TABLE document_rev_table (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
document_id TEXT NOT NULL DEFAULT '',
base_rev_id BIGINT NOT NULL DEFAULT 0,
rev_id BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x''),
state INTEGER NOT NULL DEFAULT 0
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE grid_rev_snapshot;

View File

@ -0,0 +1,9 @@
-- Your SQL goes here
CREATE TABLE grid_rev_snapshot (
snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
object_id TEXT NOT NULL DEFAULT '',
rev_id BIGINT NOT NULL DEFAULT 0,
base_rev_id BIGINT NOT NULL DEFAULT 0,
timestamp BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x'')
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE folder_rev_snapshot;

View File

@ -0,0 +1,9 @@
-- Your SQL goes here
CREATE TABLE folder_rev_snapshot (
snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
object_id TEXT NOT NULL DEFAULT '',
rev_id BIGINT NOT NULL DEFAULT 0,
base_rev_id BIGINT NOT NULL DEFAULT 0,
timestamp BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x'')
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE document_rev_snapshot;

View File

@ -0,0 +1,9 @@
-- Your SQL goes here
CREATE TABLE document_rev_snapshot (
snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
object_id TEXT NOT NULL DEFAULT '',
rev_id BIGINT NOT NULL DEFAULT 0,
base_rev_id BIGINT NOT NULL DEFAULT 0,
timestamp BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x'')
);