diff --git a/src-tauri/migrations/0001_path_node_table.sql b/src-tauri/migrations/0001_path_node_table.sql deleted file mode 100644 index fd68084..0000000 --- a/src-tauri/migrations/0001_path_node_table.sql +++ /dev/null @@ -1,9 +0,0 @@ --- migrate:up -CREATE TABLE PathNode ( - id integer primary key, - title text, - description text -); - --- migrate:down --- DROP TABLE PathNode; \ No newline at end of file diff --git a/src-tauri/migrations/0001_path_table.down.sql b/src-tauri/migrations/0001_path_table.down.sql new file mode 100644 index 0000000..4f01373 --- /dev/null +++ b/src-tauri/migrations/0001_path_table.down.sql @@ -0,0 +1,2 @@ +DROP TABLE pathVersions; +DROP TABLE path; \ No newline at end of file diff --git a/src-tauri/migrations/0001_path_table.up.sql b/src-tauri/migrations/0001_path_table.up.sql new file mode 100644 index 0000000..0be4f62 --- /dev/null +++ b/src-tauri/migrations/0001_path_table.up.sql @@ -0,0 +1,12 @@ +CREATE TABLE path ( + id integer primary key, + title text, + description text, + versions text +); + +CREATE TABLE pathVersions ( + pathId integer references path(id), + versionNumber string, + primary key (pathId, versionNumber) +); \ No newline at end of file diff --git a/src-tauri/migrations/0002_node_exercise.sql b/src-tauri/migrations/0002_node_exercise.sql deleted file mode 100644 index d1e2d93..0000000 --- a/src-tauri/migrations/0002_node_exercise.sql +++ /dev/null @@ -1,9 +0,0 @@ --- migrate:up -create table NodeExercise ( - id integer primary key, - ex_type text, - content text -); - --- migrate:down --- DROP TABLE NodeExercise; \ No newline at end of file diff --git a/src-tauri/migrations/0002_node_table.down.sql b/src-tauri/migrations/0002_node_table.down.sql new file mode 100644 index 0000000..7f8e4a9 --- /dev/null +++ b/src-tauri/migrations/0002_node_table.down.sql @@ -0,0 +1 @@ +DROP TABLE node; \ No newline at end of file diff --git a/src-tauri/migrations/0002_node_table.up.sql b/src-tauri/migrations/0002_node_table.up.sql new file mode 100644 index 0000000..c1bb8a9 --- /dev/null +++ b/src-tauri/migrations/0002_node_table.up.sql @@ -0,0 +1,6 @@ +CREATE TABLE node ( + id integer primary key, + title text, + description text, + pathId integer references path(id) +); \ No newline at end of file diff --git a/src-tauri/migrations/0003_exercise_table.down.sql b/src-tauri/migrations/0003_exercise_table.down.sql new file mode 100644 index 0000000..f460e08 --- /dev/null +++ b/src-tauri/migrations/0003_exercise_table.down.sql @@ -0,0 +1 @@ +DROP TABLE exercise; \ No newline at end of file diff --git a/src-tauri/migrations/0003_exercise_table.up.sql b/src-tauri/migrations/0003_exercise_table.up.sql new file mode 100644 index 0000000..ece6cd0 --- /dev/null +++ b/src-tauri/migrations/0003_exercise_table.up.sql @@ -0,0 +1,6 @@ +create table exercise ( + id integer primary key, + ex_type text, + content text, + nodeId integer references node(id) +); \ No newline at end of file diff --git a/src/interfaces/PathNode.ts b/src/interfaces/Node.ts similarity index 100% rename from src/interfaces/PathNode.ts rename to src/interfaces/Node.ts