Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove commits #3177

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions lix/packages/sdk/src/change-queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ test("should use queue and settled correctly", async () => {
value: {
text: "test",
},
commit_id: null,
},
]);

// Test replacing uncommitted changes and multiple changes processing
await lix.db
.updateTable("file")
.set({ data: enc.encode("test updated text") })
Expand Down Expand Up @@ -166,11 +164,9 @@ test("should use queue and settled correctly", async () => {
value: {
text: "test",
},
commit_id: null,
},
{
author: null,
commit_id: null,
entity_id: "test",
created_at: updatedChanges[1]?.created_at,
snapshot_id: updatedChanges[1]?.snapshot_id,
Expand All @@ -185,7 +181,6 @@ test("should use queue and settled correctly", async () => {
},
{
author: null,
commit_id: null,
created_at: updatedChanges[2]?.created_at,
snapshot_id: updatedChanges[2]?.snapshot_id,
file_id: "test",
Expand All @@ -199,8 +194,6 @@ test("should use queue and settled correctly", async () => {
},
},
]);

await lix.commit({ description: "test commit" });
});

test("changes should contain the author", async () => {
Expand Down
158 changes: 0 additions & 158 deletions lix/packages/sdk/src/commit.test.ts

This file was deleted.

63 changes: 0 additions & 63 deletions lix/packages/sdk/src/commit.ts

This file was deleted.

16 changes: 0 additions & 16 deletions lix/packages/sdk/src/database/applySchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import type { SqliteDatabase } from "sqlite-wasm-kysely";
*/
export async function applySchema(args: { sqlite: SqliteDatabase }) {
return args.sqlite.exec`
CREATE TABLE IF NOT EXISTS ref (
name TEXT PRIMARY KEY,
commit_id TEXT
);

CREATE TABLE IF NOT EXISTS file_internal (
id TEXT PRIMARY KEY DEFAULT (uuid_v4()),
Expand Down Expand Up @@ -39,7 +35,6 @@ export async function applySchema(args: { sqlite: SqliteDatabase }) {
file_id TEXT NOT NULL,
plugin_key TEXT NOT NULL,
snapshot_id TEXT NOT NULL,
commit_id TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL
) strict;

Expand All @@ -58,17 +53,6 @@ export async function applySchema(args: { sqlite: SqliteDatabase }) {
resolved_change_id TEXT,
PRIMARY KEY (change_id, conflicting_change_id)
) strict;

CREATE TABLE IF NOT EXISTS 'commit' (
id TEXT PRIMARY KEY DEFAULT (uuid_v4()),
author TEXT,
parent_id TEXT NOT NULL,
description TEXT NOT NULL,
created TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL,
created_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL
) strict;

INSERT OR IGNORE INTO ref values ('current', '00000000-0000-0000-0000-000000000000');

CREATE TRIGGER IF NOT EXISTS file_update INSTEAD OF UPDATE ON file
BEGIN
Expand Down
16 changes: 0 additions & 16 deletions lix/packages/sdk/src/database/initDb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ test("file ids should default to uuid", async () => {
expect(validate(file.id)).toBe(true);
});

test("commit ids should default to uuid", async () => {
const sqlite = await createInMemoryDatabase({
readOnly: false,
});
const db = initDb({ sqlite });

const commit = await db
.insertInto("commit")
.values({ parent_id: "mock", description: "mock" })
.returningAll()
.executeTakeFirstOrThrow();

expect(validate(commit.id)).toBe(true);
});

test("change ids should default to uuid", async () => {
const sqlite = await createInMemoryDatabase({
readOnly: false,
Expand All @@ -42,7 +27,6 @@ test("change ids should default to uuid", async () => {
const change = await db
.insertInto("change")
.values({
commit_id: "mock",
type: "file",
entity_id: "value1",
file_id: "mock",
Expand Down
Loading
Loading