-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redo the EdgeDB project modules to rely on them rather than migration…
…s for version checking (#176)
- Loading branch information
Showing
28 changed files
with
214 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,37 @@ | ||
CREATE MIGRATION m1ud5ykhpyzl7tdyqf6w5nezyy75753dwy2kmeznqedph2ddww6cia | ||
CREATE MIGRATION m1c65s2cgnjqbm4zvuyv6saeqpi5c446bceydxxr35zmjbf2ndymsq | ||
ONTO initial | ||
{ | ||
CREATE ABSTRACT LINK default::crew { | ||
CREATE PROPERTY list_order -> std::int64; | ||
}; | ||
CREATE ABSTRACT TYPE default::HasImage { | ||
CREATE REQUIRED PROPERTY image -> std::str; | ||
CREATE INDEX ON (.image); | ||
}; | ||
CREATE TYPE default::Movie EXTENDING default::HasImage { | ||
CREATE PROPERTY description -> std::str; | ||
CREATE REQUIRED PROPERTY title -> std::str; | ||
CREATE REQUIRED PROPERTY year -> std::int64; | ||
CREATE INDEX ON (.year); | ||
CREATE INDEX ON ((.title, .year)); | ||
CREATE INDEX ON (.title); | ||
}; | ||
CREATE TYPE default::User EXTENDING default::HasImage { | ||
CREATE REQUIRED PROPERTY name -> std::str; | ||
}; | ||
CREATE TYPE default::Review { | ||
CREATE REQUIRED LINK movie -> default::Movie; | ||
CREATE REQUIRED PROPERTY rating -> std::int64 { | ||
CREATE CONSTRAINT std::max_value(5); | ||
CREATE CONSTRAINT std::min_value(0); | ||
}; | ||
CREATE REQUIRED LINK author -> default::User; | ||
CREATE REQUIRED PROPERTY body -> std::str; | ||
CREATE REQUIRED PROPERTY creation_time -> std::datetime { | ||
SET default := (std::datetime_current()); | ||
CREATE MODULE v1 IF NOT EXISTS; | ||
CREATE ABSTRACT LINK v1::crew { | ||
CREATE PROPERTY list_order: std::int64; | ||
}; | ||
CREATE TYPE v1::Person { | ||
CREATE REQUIRED PROPERTY first_name: std::str; | ||
CREATE REQUIRED PROPERTY last_name: std::str; | ||
CREATE REQUIRED PROPERTY middle_name: std::str; | ||
}; | ||
CREATE TYPE v1::Movie { | ||
CREATE MULTI LINK actors: v1::Person { | ||
EXTENDING v1::crew; | ||
}; | ||
CREATE REQUIRED PROPERTY flag -> std::bool { | ||
SET default := false; | ||
CREATE MULTI LINK directors: v1::Person { | ||
EXTENDING v1::crew; | ||
}; | ||
CREATE PROPERTY description: std::str; | ||
CREATE REQUIRED PROPERTY title: std::str; | ||
CREATE REQUIRED PROPERTY year: std::int64; | ||
}; | ||
ALTER TYPE default::Movie { | ||
CREATE PROPERTY avg_rating := (math::mean(.<movie[IS default::Review].rating)); | ||
}; | ||
CREATE ALIAS default::MovieAlias := ( | ||
default::Movie { | ||
reviews := .<movie[IS default::Review] | ||
} | ||
); | ||
CREATE ALIAS default::ReviewAlias := ( | ||
default::Review { | ||
author_name := .author.name, | ||
movie_title := .movie.title | ||
} | ||
); | ||
CREATE ABSTRACT LINK default::actors EXTENDING default::crew; | ||
CREATE TYPE default::Person EXTENDING default::HasImage { | ||
CREATE PROPERTY bio -> std::str; | ||
CREATE REQUIRED PROPERTY first_name -> std::str { | ||
SET default := ''; | ||
}; | ||
CREATE REQUIRED PROPERTY last_name -> std::str; | ||
CREATE REQUIRED PROPERTY middle_name -> std::str { | ||
SET default := ''; | ||
}; | ||
CREATE PROPERTY full_name := (((((.first_name ++ ' ') IF (.first_name != '') ELSE '') ++ ((.middle_name ++ ' ') IF (.middle_name != '') ELSE '')) ++ .last_name)); | ||
}; | ||
ALTER TYPE default::Movie { | ||
CREATE MULTI LINK actors EXTENDING default::crew -> default::Person; | ||
CREATE MULTI LINK directors EXTENDING default::crew -> default::Person; | ||
}; | ||
CREATE ABSTRACT LINK default::directors EXTENDING default::crew; | ||
CREATE SCALAR TYPE default::TicketNo EXTENDING std::sequence; | ||
CREATE TYPE default::Ticket { | ||
CREATE PROPERTY number -> default::TicketNo { | ||
CREATE SCALAR TYPE v1::TicketNo EXTENDING std::sequence; | ||
CREATE TYPE v1::Ticket { | ||
CREATE PROPERTY number: v1::TicketNo { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
CREATE SCALAR TYPE default::Color EXTENDING enum<Red, Green, Blue>; | ||
CREATE SCALAR TYPE default::short_str EXTENDING std::str { | ||
CREATE TYPE v1::User { | ||
CREATE REQUIRED PROPERTY name: std::str; | ||
}; | ||
CREATE SCALAR TYPE v1::Color EXTENDING enum<Red, Green, Blue>; | ||
CREATE SCALAR TYPE v1::short_str EXTENDING std::str { | ||
CREATE CONSTRAINT std::max_len_value(5); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
CREATE MIGRATION m1ryrngpym75cc5zcmkrfebkg6dcmyflzu7727vnjhmy2zl4q3tjda | ||
ONTO m1ud5ykhpyzl7tdyqf6w5nezyy75753dwy2kmeznqedph2ddww6cia | ||
CREATE MIGRATION m1s4rwuphzakukj3i6wqbwi534ctcmaulpn4a4wfclpejyowtxkloq | ||
ONTO m1c65s2cgnjqbm4zvuyv6saeqpi5c446bceydxxr35zmjbf2ndymsq | ||
{ | ||
CREATE GLOBAL default::current_user -> std::str; | ||
CREATE MODULE v2 IF NOT EXISTS; | ||
CREATE GLOBAL v2::current_user -> std::str; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
CREATE MIGRATION m16wualxmsuqqryhwrn6kgd6upwxge3cwruitgz63wbe5mynxxieva | ||
ONTO m1ryrngpym75cc5zcmkrfebkg6dcmyflzu7727vnjhmy2zl4q3tjda | ||
CREATE MIGRATION m17xqasqccfam62oqoyltgemn7mrdws33vik4bodj67kcmwfa3mq6q | ||
ONTO m1s4rwuphzakukj3i6wqbwi534ctcmaulpn4a4wfclpejyowtxkloq | ||
{ | ||
CREATE EXTENSION pgvector VERSION '0.4'; | ||
CREATE SCALAR TYPE default::ExVector EXTENDING ext::pgvector::vector<1602>; | ||
CREATE MODULE v3 IF NOT EXISTS; | ||
CREATE SCALAR TYPE v3::ExVector EXTENDING ext::pgvector::vector<1602>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE MIGRATION m12bi2uxbraa4docb2s3ajj5eodgcc2gbno6cf2jrwudhz6mhhdvta | ||
ONTO m17xqasqccfam62oqoyltgemn7mrdws33vik4bodj67kcmwfa3mq6q | ||
{ | ||
CREATE MODULE v4 IF NOT EXISTS; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module v1 { | ||
scalar type Color extending enum<Red, Green, Blue>; | ||
scalar type TicketNo extending sequence; | ||
|
||
scalar type short_str extending str { | ||
constraint max_len_value(5); | ||
}; | ||
|
||
type User { | ||
required property name -> str; | ||
} | ||
|
||
type Person { | ||
required property first_name -> str; | ||
required property middle_name -> str; | ||
required property last_name -> str; | ||
} | ||
|
||
abstract link crew { | ||
property list_order -> int64; | ||
} | ||
|
||
type Movie { | ||
required property title -> str; | ||
required property year -> int64; | ||
property description -> str; | ||
|
||
multi link directors extending crew -> Person; | ||
multi link actors extending crew -> Person; | ||
} | ||
|
||
type Ticket { | ||
property number -> TicketNo { | ||
constraint exclusive; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module v2 { | ||
global current_user -> str; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using extension pgvector; | ||
|
||
module v3 { | ||
scalar type ExVector extending ext::pgvector::vector<1602>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module v4 {} |
Oops, something went wrong.