Skip to content

Commit 29255af

Browse files
author
Nap Joseph Calub
committed
feat: rename files
1 parent 83e5e67 commit 29255af

8 files changed

Lines changed: 35 additions & 2 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Migration: create utils
2+
3+
BEGIN TRANSACTION;
4+
5+
--------------------------------------------------------------------------------
6+
7+
REMOVE FUNCTION IF EXISTS fn::has_references;
8+
9+
--------------------------------------------------------------------------------
10+
11+
COMMIT TRANSACTION;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Migration: create utils
2+
3+
BEGIN TRANSACTION;
4+
5+
--------------------------------------------------------------------------------
6+
7+
DEFINE FUNCTION fn::has_references(
8+
$record: record,
9+
$check_incoming: bool,
10+
$check_outgoing: bool
11+
) {
12+
LET $incoming = IF $check_incoming THEN (SELECT VALUE <-(?) FROM ONLY $record) ELSE [] END;
13+
LET $outgoing = IF $check_outgoing THEN (SELECT VALUE ->(?) FROM ONLY $record) ELSE [] END;
14+
LET $total_refs = array::len($incoming) + array::len($outgoing);
15+
IF $total_refs > 0 { RETURN true };
16+
RETURN false;
17+
};
18+
19+
--------------------------------------------------------------------------------
20+
21+
COMMIT TRANSACTION;

migrations/tenants/001_20250710_093749_create_users.down.surql renamed to migrations/tenants/002_20250710_093749_create_users.down.surql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ BEGIN TRANSACTION;
77
REMOVE INDEX IF EXISTS user_email_index ON user;
88
REMOVE ACCESS IF EXISTS user ON DATABASE;
99
REMOVE TABLE IF EXISTS user;
10+
REMOVE EVENT IF EXISTS prevent_deletion ON TABLE person;
1011
REMOVE TABLE IF EXISTS person;
11-
REMOVE TABLE IF EXISTS is_person;
12+
REMOVE TABLE IF EXISTS has_profile;
1213

1314
--------------------------------------------------------------------------------
1415

migrations/tenants/001_20250710_093749_create_users.surql renamed to migrations/tenants/002_20250710_093749_create_users.surql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ DEFINE FIELD created_at ON person TYPE datetime VALUE time::now() READONLY;
5656

5757
--------------------------------------------------------------------------------
5858

59-
DEFINE TABLE is_person TYPE RELATION FROM user TO person ENFORCED;
59+
DEFINE TABLE has_profile TYPE RELATION FROM user TO person ENFORCED;
6060

6161
--------------------------------------------------------------------------------
6262

migrations/tenants/002_20250711_213213_create_permissions.down.surql renamed to migrations/tenants/003_20250711_213213_create_permissions.down.surql

File renamed without changes.

migrations/tenants/002_20250711_213213_create_permissions.surql renamed to migrations/tenants/003_20250711_213213_create_permissions.surql

File renamed without changes.

migrations/tenants/003_20250715_003233_add_sample_fixtures.down.surql renamed to migrations/tenants/004_20250715_003233_add_sample_fixtures.down.surql

File renamed without changes.

migrations/tenants/003_20250715_003233_add_sample_fixtures.surql renamed to migrations/tenants/004_20250715_003233_add_sample_fixtures.surql

File renamed without changes.

0 commit comments

Comments
 (0)