Skip to content

Commit

Permalink
Removed ronin.locked meta field
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed Feb 11, 2025
1 parent dd05c91 commit 2a40a93
Show file tree
Hide file tree
Showing 13 changed files with 148 additions and 246 deletions.
5 changes: 0 additions & 5 deletions src/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ export const getSystemFields = (idPrefix: Model['idPrefix']): Array<ModelField>
[QUERY_SYMBOLS.EXPRESSION]: `'${idPrefix}_' || lower(substr(hex(randomblob(12)), 1, 16))`,
},
},
{
name: 'RONIN - Locked',
type: 'boolean',
slug: 'ronin.locked',
},
{
name: 'RONIN - Created At',
type: 'date',
Expand Down
1 change: 0 additions & 1 deletion src/types/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export type Row = RawRow | ObjectRow;
export type ResultRecord = Record<string, unknown> & {
id: string;
ronin: {
locked: boolean;
createdAt: string;
createdBy: string | null;
updatedAt: string;
Expand Down
40 changes: 10 additions & 30 deletions tests/instructions/before-after.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test('get multiple records before cursor', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" WHERE (("ronin.createdAt" > '2024-12-08T10:47:58.079Z')) ORDER BY "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" WHERE (("ronin.createdAt" > '2024-12-08T10:47:58.079Z')) ORDER BY "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -53,7 +53,6 @@ test('get multiple records before cursor', async () => {
{
id: 'bea_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -64,7 +63,6 @@ test('get multiple records before cursor', async () => {
{
id: 'bea_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -109,7 +107,7 @@ test('get multiple records before cursor ordered by string field', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" WHERE ((IFNULL("name", -1e999) < ?1 COLLATE NOCASE) OR ("name" = ?1 AND ("ronin.createdAt" > '2024-12-10T10:47:58.079Z'))) ORDER BY "name" COLLATE NOCASE ASC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" WHERE ((IFNULL("name", -1e999) < ?1 COLLATE NOCASE) OR ("name" = ?1 AND ("ronin.createdAt" > '2024-12-10T10:47:58.079Z'))) ORDER BY "name" COLLATE NOCASE ASC, "ronin.createdAt" DESC LIMIT 3`,
params: ['Manly'],
returning: true,
},
Expand All @@ -128,7 +126,6 @@ test('get multiple records before cursor ordered by string field', async () => {
{
id: 'bea_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -139,7 +136,6 @@ test('get multiple records before cursor ordered by string field', async () => {
{
id: 'bea_39h8fhe98hefah1j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -184,7 +180,7 @@ test('get multiple records before cursor ordered by boolean field', async () =>

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "pending" FROM "members" WHERE ((IFNULL("pending", -1e999) < ?1) OR ("pending" = ?1 AND ("ronin.createdAt" > '2024-10-09T10:47:58.079Z'))) ORDER BY "pending" ASC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "pending" FROM "members" WHERE ((IFNULL("pending", -1e999) < ?1) OR ("pending" = ?1 AND ("ronin.createdAt" > '2024-10-09T10:47:58.079Z'))) ORDER BY "pending" ASC, "ronin.createdAt" DESC LIMIT 3`,
params: [1],
returning: true,
},
Expand All @@ -203,7 +199,6 @@ test('get multiple records before cursor ordered by boolean field', async () =>
{
id: 'mem_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -214,7 +209,6 @@ test('get multiple records before cursor ordered by boolean field', async () =>
{
id: 'mem_39h8fhe98hefah8j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -263,7 +257,7 @@ test('get multiple records before cursor ordered by number field', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "position", "name" FROM "products" WHERE (("position" > ?1) OR ("position" = ?1 AND ("ronin.createdAt" > '2024-12-11T10:47:58.079Z'))) ORDER BY "position" DESC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "position", "name" FROM "products" WHERE (("position" > ?1) OR ("position" = ?1 AND ("ronin.createdAt" > '2024-12-11T10:47:58.079Z'))) ORDER BY "position" DESC, "ronin.createdAt" DESC LIMIT 3`,
params: [1],
returning: true,
},
Expand All @@ -282,7 +276,6 @@ test('get multiple records before cursor ordered by number field', async () => {
{
id: 'pro_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -294,7 +287,6 @@ test('get multiple records before cursor ordered by number field', async () => {
{
id: 'pro_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -344,7 +336,7 @@ test('get multiple records before cursor ordered by empty string field', async (

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "sandColor" FROM "beaches" WHERE (("sandColor" IS NOT NULL) OR ("sandColor" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "sandColor" COLLATE NOCASE DESC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "sandColor" FROM "beaches" WHERE (("sandColor" IS NOT NULL) OR ("sandColor" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "sandColor" COLLATE NOCASE DESC, "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -360,7 +352,6 @@ test('get multiple records before cursor ordered by empty string field', async (
{
id: 'bea_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -372,7 +363,6 @@ test('get multiple records before cursor ordered by empty string field', async (
{
id: 'bea_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -424,7 +414,7 @@ test('get multiple records before cursor ordered by empty boolean field', async

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "swimmingAllowed" FROM "beaches" WHERE (("swimmingAllowed" IS NOT NULL) OR ("swimmingAllowed" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "swimmingAllowed" DESC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "swimmingAllowed" FROM "beaches" WHERE (("swimmingAllowed" IS NOT NULL) OR ("swimmingAllowed" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "swimmingAllowed" DESC, "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -443,7 +433,6 @@ test('get multiple records before cursor ordered by empty boolean field', async
{
id: 'bea_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -455,7 +444,6 @@ test('get multiple records before cursor ordered by empty boolean field', async
{
id: 'bea_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -505,7 +493,7 @@ test('get multiple records before cursor ordered by empty number field', async (

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "rating" FROM "beaches" WHERE (("rating" IS NOT NULL) OR ("rating" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "rating" DESC, "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name", "rating" FROM "beaches" WHERE (("rating" IS NOT NULL) OR ("rating" IS NULL AND ("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "rating" DESC, "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -521,7 +509,6 @@ test('get multiple records before cursor ordered by empty number field', async (
{
id: 'bea_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -533,7 +520,6 @@ test('get multiple records before cursor ordered by empty number field', async (
{
id: 'bea_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -583,7 +569,7 @@ test('get multiple records before cursor while filtering', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "products" WHERE ("name" IS NOT NULL AND (("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "products" WHERE ("name" IS NOT NULL AND (("ronin.createdAt" > '2024-12-08T10:47:58.079Z'))) ORDER BY "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -599,7 +585,6 @@ test('get multiple records before cursor while filtering', async () => {
{
id: 'pro_39h8fhe98hefah9j',
ronin: {
locked: false,
createdAt: firstRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -610,7 +595,6 @@ test('get multiple records before cursor while filtering', async () => {
{
id: 'pro_39h8fhe98hefah0j',
ronin: {
locked: false,
createdAt: lastRecordTime.toISOString(),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -652,7 +636,7 @@ test('get multiple records before undefined cursor', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" ORDER BY "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" ORDER BY "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -665,7 +649,6 @@ test('get multiple records before undefined cursor', async () => {
{
id: expect.stringMatching(RECORD_ID_REGEX),
ronin: {
locked: false,
createdAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -676,7 +659,6 @@ test('get multiple records before undefined cursor', async () => {
{
id: expect.stringMatching(RECORD_ID_REGEX),
ronin: {
locked: false,
createdAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down Expand Up @@ -715,7 +697,7 @@ test('get multiple records after undefined cursor', async () => {

expect(transaction.statements).toEqual([
{
statement: `SELECT "id", "ronin.locked", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" ORDER BY "ronin.createdAt" DESC LIMIT 3`,
statement: `SELECT "id", "ronin.createdAt", "ronin.createdBy", "ronin.updatedAt", "ronin.updatedBy", "name" FROM "beaches" ORDER BY "ronin.createdAt" DESC LIMIT 3`,
params: [],
returning: true,
},
Expand All @@ -728,7 +710,6 @@ test('get multiple records after undefined cursor', async () => {
{
id: expect.stringMatching(RECORD_ID_REGEX),
ronin: {
locked: false,
createdAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand All @@ -739,7 +720,6 @@ test('get multiple records after undefined cursor', async () => {
{
id: expect.stringMatching(RECORD_ID_REGEX),
ronin: {
locked: false,
createdAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
createdBy: null,
updatedAt: expect.stringMatching(RECORD_TIMESTAMP_REGEX),
Expand Down
Loading

0 comments on commit 2a40a93

Please sign in to comment.