skyward-orm 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +247 -60
- data/lib/skyward/orm/adapters/postgresql/connection.rb +64 -4
- data/lib/skyward/orm/adapters/postgresql.rb +189 -68
- data/lib/skyward/orm/adapters/sqlite/connection.rb +87 -0
- data/lib/skyward/orm/adapters/sqlite/constraints.rb +32 -14
- data/lib/skyward/orm/adapters/sqlite.rb +158 -45
- data/lib/skyward/orm/adapters/statement_cache.rb +51 -0
- data/lib/skyward/orm/adapters.rb +23 -7
- data/lib/skyward/orm/catalog/column.rb +2 -1
- data/lib/skyward/orm/cli/boot_file.rb +4 -4
- data/lib/skyward/orm/cli/migrate.rb +1 -1
- data/lib/skyward/orm/cli/migration.rb +8 -8
- data/lib/skyward/orm/cli/scaffold/source.rb +323 -0
- data/lib/skyward/orm/cli/scaffold.rb +70 -0
- data/lib/skyward/orm/cli/status.rb +5 -3
- data/lib/skyward/orm/commands.rb +20 -8
- data/lib/skyward/orm/connection/instrumented.rb +71 -0
- data/lib/skyward/orm/connection/pool.rb +2 -2
- data/lib/skyward/orm/connection/session.rb +74 -5
- data/lib/skyward/orm/database/decoders.rb +41 -0
- data/lib/skyward/orm/{connection/database → database}/schema_check.rb +22 -10
- data/lib/skyward/orm/{connection/database.rb → database.rb} +70 -36
- data/lib/skyward/orm/execution.rb +9 -0
- data/lib/skyward/orm/migrations/alter_table.rb +6 -2
- data/lib/skyward/orm/migrations/definitions.rb +20 -17
- data/lib/skyward/orm/migrations/diff.rb +156 -32
- data/lib/skyward/orm/migrations/directory.rb +5 -5
- data/lib/skyward/orm/migrations/rename_constraint.rb +8 -0
- data/lib/skyward/orm/migrations/runner.rb +21 -11
- data/lib/skyward/orm/migrations/script.rb +67 -27
- data/lib/skyward/orm/migrations/status.rb +38 -9
- data/lib/skyward/orm/migrations/summary.rb +23 -26
- data/lib/skyward/orm/migrations/versions.rb +3 -4
- data/lib/skyward/orm/migrations.rb +1 -1
- data/lib/skyward/orm/projection.rb +24 -11
- data/lib/skyward/orm/queries/clauses.rb +298 -124
- data/lib/skyward/orm/query.rb +2 -2
- data/lib/skyward/orm/record.rb +27 -9
- data/lib/skyward/orm/{placeholders.rb → statements/placeholders.rb} +4 -4
- data/lib/skyward/orm/statements.rb +178 -31
- data/lib/skyward/orm/tables/column.rb +2 -1
- data/lib/skyward/orm/tables/column_types.rb +63 -16
- data/lib/skyward/orm/tables/declarations.rb +43 -15
- data/lib/skyward/orm/{members.rb → tables/members.rb} +1 -1
- data/lib/skyward/orm/tables/rows.rb +28 -10
- data/lib/skyward/orm/tables/sources.rb +63 -0
- data/lib/skyward/orm/tables/validation.rb +12 -3
- data/lib/skyward/orm/tables/values.rb +124 -14
- data/lib/skyward/orm/tables.rb +2 -1
- data/lib/skyward/orm/transactional.rb +2 -2
- data/lib/skyward/orm/version.rb +1 -1
- data/lib/skyward/orm.rb +52 -17
- data/sig/generated/skyward/orm/adapters/postgresql/connection.rbs +35 -3
- data/sig/generated/skyward/orm/adapters/postgresql.rbs +64 -14
- data/sig/generated/skyward/orm/adapters/sqlite/connection.rbs +55 -0
- data/sig/generated/skyward/orm/adapters/sqlite/constraints.rbs +6 -0
- data/sig/generated/skyward/orm/adapters/sqlite.rbs +72 -7
- data/sig/generated/skyward/orm/adapters/statement_cache.rbs +37 -0
- data/sig/generated/skyward/orm/adapters.rbs +6 -0
- data/sig/generated/skyward/orm/catalog/column.rbs +6 -4
- data/sig/generated/skyward/orm/cli/boot_file.rbs +4 -4
- data/sig/generated/skyward/orm/cli/migrate.rbs +2 -2
- data/sig/generated/skyward/orm/cli/migration.rbs +2 -2
- data/sig/generated/skyward/orm/cli/scaffold/source.rbs +158 -0
- data/sig/generated/skyward/orm/cli/scaffold.rbs +28 -0
- data/sig/generated/skyward/orm/cli/status.rbs +2 -2
- data/sig/generated/skyward/orm/connection/instrumented.rbs +47 -0
- data/sig/generated/skyward/orm/connection/session.rbs +40 -6
- data/sig/generated/skyward/orm/database/decoders.rbs +19 -0
- data/sig/generated/skyward/orm/{connection/database → database}/schema_check.rbs +11 -4
- data/sig/generated/skyward/orm/{connection/database.rbs → database.rbs} +40 -17
- data/sig/generated/skyward/orm/execution.rbs +18 -0
- data/sig/generated/skyward/orm/migrations/alter_table.rbs +11 -5
- data/sig/generated/skyward/orm/migrations/definitions.rbs +2 -2
- data/sig/generated/skyward/orm/migrations/diff.rbs +77 -11
- data/sig/generated/skyward/orm/migrations/rename_constraint.rbs +16 -0
- data/sig/generated/skyward/orm/migrations/runner.rbs +5 -0
- data/sig/generated/skyward/orm/migrations/script.rbs +32 -8
- data/sig/generated/skyward/orm/migrations/status.rbs +15 -2
- data/sig/generated/skyward/orm/migrations/summary.rbs +0 -1
- data/sig/generated/skyward/orm/migrations/versions.rbs +2 -2
- data/sig/generated/skyward/orm/migrations.rbs +1 -1
- data/sig/generated/skyward/orm/projection.rbs +10 -2
- data/sig/generated/skyward/orm/queries/clauses.rbs +129 -40
- data/sig/generated/skyward/orm/record.rbs +14 -7
- data/sig/generated/skyward/orm/{placeholders.rbs → statements/placeholders.rbs} +2 -2
- data/sig/generated/skyward/orm/statements.rbs +84 -8
- data/sig/generated/skyward/orm/tables/column.rbs +6 -4
- data/sig/generated/skyward/orm/tables/column_types.rbs +18 -4
- data/sig/generated/skyward/orm/tables/declarations.rbs +15 -1
- data/sig/generated/skyward/orm/{members.rbs → tables/members.rbs} +2 -2
- data/sig/generated/skyward/orm/tables/rows.rbs +1 -1
- data/sig/generated/skyward/orm/tables/sources.rbs +32 -0
- data/sig/generated/skyward/orm/tables/values.rbs +41 -1
- data/sig/generated/skyward/orm/tables.rbs +3 -1
- data/sig/generated/skyward/orm.rbs +6 -6
- data/sig/manual/pg.rbs +22 -0
- data/sig/manual/skyward/orm/cli/scaffold/source.rbs +3 -0
- data/sig/manual/skyward/orm/cli/scaffold.rbs +3 -0
- data/sig/manual/skyward/orm/database/decoders.rbs +3 -0
- data/sig/manual/skyward/orm/database/schema_check.rbs +3 -0
- data/sig/manual/skyward/orm/statements/placeholders.rbs +3 -0
- data/sig/manual/skyward/orm/tables/members.rbs +3 -0
- data/sig/manual/skyward/orm/tables/sources.rbs +3 -0
- data/sig/manual/skyward/orm.rbs +41 -8
- data/sig/manual/sqlite3.rbs +13 -2
- metadata +51 -14
- data/sig/manual/skyward/orm/connection/database/schema_check.rbs +0 -3
- data/sig/manual/skyward/orm/members.rbs +0 -3
- data/sig/manual/skyward/orm/placeholders.rbs +0 -3
|
@@ -11,7 +11,7 @@ module Skyward::ORM::CLI::Status
|
|
|
11
11
|
|
|
12
12
|
private
|
|
13
13
|
|
|
14
|
-
# @rbs (Skyward::ORM::
|
|
14
|
+
# @rbs (Skyward::ORM::Database database, directory: String, out: _Writer, kernel: singleton(Kernel),
|
|
15
15
|
# discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
16
|
-
def report: (Skyward::ORM::
|
|
16
|
+
def report: (Skyward::ORM::Database database, directory: String, out: _Writer, kernel: singleton(Kernel), discover: ^() -> Array[singleton(Skyward::ORM::Record)]) -> void
|
|
17
17
|
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/connection/instrumented.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Skyward::ORM::Connection::Instrumented
|
|
4
|
+
ONCE: String
|
|
5
|
+
|
|
6
|
+
@connection: Skyward::ORM::_Connection
|
|
7
|
+
|
|
8
|
+
@instrument: Skyward::ORM::_Instrument
|
|
9
|
+
|
|
10
|
+
@adapter: Symbol
|
|
11
|
+
|
|
12
|
+
@clock_ms: ^() -> Float
|
|
13
|
+
|
|
14
|
+
# @rbs (Skyward::ORM::_Connection connection, Skyward::ORM::_Instrument instrument, Symbol adapter,
|
|
15
|
+
# clock_ms: ^() -> Float) -> void
|
|
16
|
+
def initialize: (Skyward::ORM::_Connection connection, Skyward::ORM::_Instrument instrument, Symbol adapter, clock_ms: ^() -> Float) -> void
|
|
17
|
+
|
|
18
|
+
# @rbs sql: String
|
|
19
|
+
# @rbs binds: Array[untyped]
|
|
20
|
+
# @rbs prepare: bool
|
|
21
|
+
# @rbs return: Array[Array[untyped]]
|
|
22
|
+
def execute: (String sql, ?Array[untyped] binds, ?prepare: bool) -> Array[Array[untyped]]
|
|
23
|
+
|
|
24
|
+
# @rbs sql: String
|
|
25
|
+
# @rbs *binds: untyped
|
|
26
|
+
# @rbs prepare: bool
|
|
27
|
+
# @rbs return: Array[Array[untyped]]
|
|
28
|
+
def execute2: (String sql, *untyped binds, ?prepare: bool) -> Array[Array[untyped]]
|
|
29
|
+
|
|
30
|
+
# @rbs sql: String
|
|
31
|
+
# @rbs return: void
|
|
32
|
+
def execute_batch: (String sql) -> void
|
|
33
|
+
|
|
34
|
+
# @rbs return: Integer
|
|
35
|
+
def changes: () -> Integer
|
|
36
|
+
|
|
37
|
+
# @rbs return: bool
|
|
38
|
+
def transaction_active?: () -> bool
|
|
39
|
+
|
|
40
|
+
# @rbs return: void
|
|
41
|
+
def close: () -> void
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# @rbs [T] (String sql, Array[untyped] binds) { () -> T } -> T
|
|
46
|
+
def instrumented: [T] (String sql, Array[untyped] binds) { () -> T } -> T
|
|
47
|
+
end
|
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
# Generated from lib/skyward/orm/connection/session.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
class Skyward::ORM::Connection::Session
|
|
4
|
-
@database: Skyward::ORM::
|
|
4
|
+
@database: Skyward::ORM::Database?
|
|
5
5
|
|
|
6
6
|
@check: bool
|
|
7
7
|
|
|
8
|
+
@current: Symbol
|
|
9
|
+
|
|
10
|
+
@holding: Symbol
|
|
11
|
+
|
|
8
12
|
# @rbs return: void
|
|
9
13
|
def initialize: () -> void
|
|
10
14
|
|
|
11
|
-
# @rbs database: Skyward::ORM::
|
|
12
|
-
# @rbs return: Skyward::ORM::
|
|
13
|
-
def connect: (Skyward::ORM::
|
|
15
|
+
# @rbs database: Skyward::ORM::Database
|
|
16
|
+
# @rbs return: Skyward::ORM::Database
|
|
17
|
+
def connect: (Skyward::ORM::Database database) -> Skyward::ORM::Database
|
|
18
|
+
|
|
19
|
+
# @rbs return: Skyward::ORM::Database
|
|
20
|
+
def database: () -> Skyward::ORM::Database
|
|
21
|
+
|
|
22
|
+
# Fiber storage is copied into the fibers and threads a fiber starts, so
|
|
23
|
+
# those it starts in the block inherit the switch.
|
|
24
|
+
# @rbs [T] (Skyward::ORM::Database database) { () -> T } -> T
|
|
25
|
+
def using: [T] (Skyward::ORM::Database database) { () -> T } -> T
|
|
26
|
+
|
|
27
|
+
# A transaction on the current database, for a test, and on each database
|
|
28
|
+
# its fiber switches to, until #release rolls them all back. The holding is
|
|
29
|
+
# kept before the database holds, so #release finds one that took a
|
|
30
|
+
# connection and then raised.
|
|
31
|
+
# @rbs return: void
|
|
32
|
+
def hold: () -> void
|
|
14
33
|
|
|
15
|
-
#
|
|
16
|
-
|
|
34
|
+
# Nothing is held when #hold raised before it could find a database.
|
|
35
|
+
# @rbs return: void
|
|
36
|
+
def release: () -> void
|
|
17
37
|
|
|
18
38
|
# @rbs return: bool
|
|
19
39
|
def check?: () -> bool
|
|
@@ -22,4 +42,18 @@ class Skyward::ORM::Connection::Session
|
|
|
22
42
|
# fixes a schema that doesn't match, and its boot.rb connects with the default.
|
|
23
43
|
# @rbs [T] () { () -> T } -> T
|
|
24
44
|
def without_check: [T] () { () -> T } -> T
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
# Only the fiber that holds: the holding is fiber-local rather than in fiber
|
|
49
|
+
# storage, so a fiber or thread it starts doesn't inherit it, since nothing
|
|
50
|
+
# would release what one held.
|
|
51
|
+
# @rbs database: Skyward::ORM::Database
|
|
52
|
+
# @rbs return: void
|
|
53
|
+
def hold_also: (Skyward::ORM::Database database) -> void
|
|
54
|
+
|
|
55
|
+
# Each database is released even when one before it raises.
|
|
56
|
+
# @rbs databases: Array[Skyward::ORM::Database]
|
|
57
|
+
# @rbs return: void
|
|
58
|
+
def release_each: (Array[Skyward::ORM::Database] databases) -> void
|
|
25
59
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/database/decoders.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Skyward::ORM::Database::Decoders
|
|
4
|
+
# @rbs (Class row, Array[Skyward::ORM::Tables::Column] columns, Array[Integer] positions,
|
|
5
|
+
# Skyward::ORM::_Adapter adapter) -> ^(Array[untyped]) -> untyped
|
|
6
|
+
def compile: (Class row, Array[Skyward::ORM::Tables::Column] columns, Array[Integer] positions, Skyward::ORM::_Adapter adapter) -> ^(Array[untyped]) -> untyped
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
# @rbs (Class row, Array[Skyward::ORM::Tables::Column] columns, Array[Integer] positions,
|
|
11
|
+
# Skyward::ORM::_Adapter adapter) -> String
|
|
12
|
+
def source: (Class row, Array[Skyward::ORM::Tables::Column] columns, Array[Integer] positions, Skyward::ORM::_Adapter adapter) -> String
|
|
13
|
+
|
|
14
|
+
# @rbs row: Class
|
|
15
|
+
# @rbs columns: Array[Skyward::ORM::Tables::Column]
|
|
16
|
+
# @rbs values: Array[String]
|
|
17
|
+
# @rbs return: String
|
|
18
|
+
def construction: (Class row, Array[Skyward::ORM::Tables::Column] columns, Array[String] values) -> String
|
|
19
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Generated from lib/skyward/orm/
|
|
1
|
+
# Generated from lib/skyward/orm/database/schema_check.rb with RBS::Inline
|
|
2
2
|
|
|
3
|
-
module Skyward::ORM::
|
|
3
|
+
module Skyward::ORM::Database::SchemaCheck
|
|
4
4
|
type problem = [ String, String, String ]
|
|
5
5
|
|
|
6
6
|
MIGRATE: String
|
|
@@ -13,9 +13,16 @@ module Skyward::ORM::Connection::Database::SchemaCheck
|
|
|
13
13
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
|
+
# A missing column is suggested only one the class doesn't declare, since
|
|
17
|
+
# one added with no migration yet would otherwise be pointed at another.
|
|
16
18
|
# @rbs (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Catalog::Table table,
|
|
17
|
-
# Skyward::ORM::Tables::Column column, Skyward::ORM::_Adapter adapter) -> Array[problem]
|
|
18
|
-
def column_problems: (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Catalog::Table table, Skyward::ORM::Tables::Column column, Skyward::ORM::_Adapter adapter) -> Array[problem]
|
|
19
|
+
# Skyward::ORM::Tables::Column column, Array[Symbol] undeclared, Skyward::ORM::_Adapter adapter) -> Array[problem]
|
|
20
|
+
def column_problems: (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Catalog::Table table, Skyward::ORM::Tables::Column column, Array[Symbol] undeclared, Skyward::ORM::_Adapter adapter) -> Array[problem]
|
|
21
|
+
|
|
22
|
+
# @rbs name: Symbol
|
|
23
|
+
# @rbs names: Array[Symbol]
|
|
24
|
+
# @rbs return: String
|
|
25
|
+
def suggest: (Symbol name, Array[Symbol] names) -> String
|
|
19
26
|
|
|
20
27
|
# @rbs stored: String
|
|
21
28
|
# @rbs declared: String
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Generated from lib/skyward/orm/
|
|
1
|
+
# Generated from lib/skyward/orm/database.rb with RBS::Inline
|
|
2
2
|
|
|
3
|
-
class Skyward::ORM::
|
|
3
|
+
class Skyward::ORM::Database
|
|
4
4
|
class Held < Data
|
|
5
5
|
attr_reader connection(): Skyward::ORM::_Connection
|
|
6
6
|
|
|
@@ -37,27 +37,38 @@ class Skyward::ORM::Connection::Database
|
|
|
37
37
|
|
|
38
38
|
FOREIGN: String
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
# Each IN list's length is a shape of its own, and so is each SQL string an
|
|
41
|
+
# app builds at run time, so the cache is bounded.
|
|
42
|
+
SHAPES: Integer
|
|
41
43
|
|
|
42
|
-
@
|
|
44
|
+
@adapter: Skyward::ORM::_Adapter
|
|
43
45
|
|
|
44
|
-
@
|
|
46
|
+
@pool: Skyward::ORM::Connection::Pool
|
|
45
47
|
|
|
46
|
-
@
|
|
48
|
+
@column_types: Skyward::ORM::Tables::ColumnTypes
|
|
49
|
+
|
|
50
|
+
@tables: Array[Skyward::ORM::Catalog::Table]
|
|
47
51
|
|
|
48
52
|
@check: bool
|
|
49
53
|
|
|
50
|
-
@
|
|
54
|
+
@checked: Set[singleton(Skyward::ORM::Record)]
|
|
51
55
|
|
|
52
|
-
@
|
|
56
|
+
@lock: Thread::Mutex
|
|
53
57
|
|
|
54
|
-
@
|
|
58
|
+
@decoders: Hash[[ singleton(Skyward::ORM::Record), Class, Array[Symbol] ], ^(Array[untyped]) -> untyped]
|
|
55
59
|
|
|
56
|
-
@
|
|
60
|
+
@sql: Hash[untyped, String]
|
|
61
|
+
|
|
62
|
+
@query_decoders: Hash[[ Class, Array[Symbol] ], ^(Array[untyped]) -> untyped]
|
|
63
|
+
|
|
64
|
+
@key: Symbol
|
|
65
|
+
|
|
66
|
+
@prepared_statements: bool
|
|
57
67
|
|
|
58
68
|
# @rbs (Skyward::ORM::_Adapter adapter, Skyward::ORM::Connection::Pool pool,
|
|
59
|
-
# Skyward::ORM::Tables::ColumnTypes column_types, Array[Skyward::ORM::Catalog::Table] tables, check: bool
|
|
60
|
-
|
|
69
|
+
# Skyward::ORM::Tables::ColumnTypes column_types, Array[Skyward::ORM::Catalog::Table] tables, check: bool,
|
|
70
|
+
# ?prepared_statements: bool) -> void
|
|
71
|
+
def initialize: (Skyward::ORM::_Adapter adapter, Skyward::ORM::Connection::Pool pool, Skyward::ORM::Tables::ColumnTypes column_types, Array[Skyward::ORM::Catalog::Table] tables, check: bool, ?prepared_statements: bool) -> void
|
|
61
72
|
|
|
62
73
|
# The seam every query runs through. Fiber storage is copied into child
|
|
63
74
|
# fibers and threads, so one can find a transaction here that isn't its own.
|
|
@@ -106,6 +117,14 @@ class Skyward::ORM::Connection::Database
|
|
|
106
117
|
# @rbs return: ^(Array[untyped]) -> untyped
|
|
107
118
|
def decoder: (singleton(Skyward::ORM::Record) table, Class row, Array[Symbol] expressed) -> ^(Array[untyped]) -> untyped
|
|
108
119
|
|
|
120
|
+
# The cache is replaced under the lock rather than changed, so a hit reads
|
|
121
|
+
# it without one, on every Ruby. A miss renders outside the lock, so two
|
|
122
|
+
# fibers may render one shape, and the SQL the first adds is the one kept.
|
|
123
|
+
# @rbs key: untyped
|
|
124
|
+
# @rbs &: () -> String
|
|
125
|
+
# @rbs return: String
|
|
126
|
+
def cached_sql: (untyped key) { () -> String } -> String
|
|
127
|
+
|
|
109
128
|
# Every query and write calls this before it touches its table, so a table
|
|
110
129
|
# class loaded after connect is checked before its first use.
|
|
111
130
|
# @rbs table: singleton(Skyward::ORM::Record)
|
|
@@ -122,8 +141,6 @@ class Skyward::ORM::Connection::Database
|
|
|
122
141
|
# @rbs return: Array[Hash[Symbol, untyped]]
|
|
123
142
|
def hashes: (String sql, Array[untyped] values) -> Array[Hash[Symbol, untyped]]
|
|
124
143
|
|
|
125
|
-
# Raw SQL picks its own columns, in its own order, so they're matched to the
|
|
126
|
-
# row class's members by name.
|
|
127
144
|
# @rbs row: Class
|
|
128
145
|
# @rbs sql: String
|
|
129
146
|
# @rbs values: Array[untyped]
|
|
@@ -163,6 +180,13 @@ class Skyward::ORM::Connection::Database
|
|
|
163
180
|
# @rbs [T] () { (Skyward::ORM::_Connection connection) -> T } -> T
|
|
164
181
|
def changing: [T] () { (Skyward::ORM::_Connection connection) -> T } -> T
|
|
165
182
|
|
|
183
|
+
# Dropping the oldest, rather than the least recently used, leaves a hit
|
|
184
|
+
# nothing to change.
|
|
185
|
+
# @rbs key: untyped
|
|
186
|
+
# @rbs sql: String
|
|
187
|
+
# @rbs return: String
|
|
188
|
+
def cache_sql: (untyped key, String sql) -> String
|
|
189
|
+
|
|
166
190
|
# @rbs held: Held
|
|
167
191
|
# @rbs return: bool
|
|
168
192
|
def owned?: (Held held) -> bool
|
|
@@ -207,10 +231,9 @@ class Skyward::ORM::Connection::Database
|
|
|
207
231
|
def build: (singleton(Skyward::ORM::Record) table, Class row, Array[Symbol] expressed) -> ^(Array[untyped]) -> untyped
|
|
208
232
|
|
|
209
233
|
# @rbs row: Class
|
|
210
|
-
# @rbs
|
|
211
|
-
# @rbs types: Array[Skyward::ORM::Tables::column_type]
|
|
234
|
+
# @rbs columns: Array[Symbol]
|
|
212
235
|
# @rbs return: ^(Array[untyped]) -> untyped
|
|
213
|
-
def
|
|
236
|
+
def query_decoder: (Class row, Array[Symbol] columns) -> ^(Array[untyped]) -> untyped
|
|
214
237
|
|
|
215
238
|
# Raw SQL returns rows, with no room for a violation, so one raises.
|
|
216
239
|
# @rbs sql: String
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/execution.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Skyward::ORM
|
|
4
|
+
class Execution < Data
|
|
5
|
+
attr_reader sql(): String
|
|
6
|
+
|
|
7
|
+
attr_reader binds(): Array[untyped]
|
|
8
|
+
|
|
9
|
+
attr_reader adapter(): Symbol
|
|
10
|
+
|
|
11
|
+
def self.new: (String sql, Array[untyped] binds, Symbol adapter) -> instance
|
|
12
|
+
| (sql: String, binds: Array[untyped], adapter: Symbol) -> instance
|
|
13
|
+
|
|
14
|
+
def self.members: () -> [ :sql, :binds, :adapter ]
|
|
15
|
+
|
|
16
|
+
def members: () -> [ :sql, :binds, :adapter ]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Skyward::ORM::Migrations
|
|
4
4
|
# A table that differs from its class: the class's columns, the table as the
|
|
5
|
-
# database has it,
|
|
5
|
+
# database has it, each difference, in the order the migration makes them,
|
|
6
|
+
# and the indexes and constraints the table keeps because the class can't
|
|
7
|
+
# declare them.
|
|
6
8
|
class AlterTable < Data
|
|
7
9
|
attr_reader klass(): singleton(Skyward::ORM::Record)
|
|
8
10
|
|
|
@@ -12,11 +14,15 @@ module Skyward::ORM::Migrations
|
|
|
12
14
|
|
|
13
15
|
attr_reader edits(): Array[edit]
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
| (klass: singleton(Skyward::ORM::Record), columns: Array[Skyward::ORM::Tables::Column], table: Skyward::ORM::Catalog::Table, edits: Array[edit]) -> instance
|
|
17
|
+
attr_reader kept_indexes(): Array[Skyward::ORM::Catalog::Index]
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
attr_reader kept_constraints(): Array[Skyward::ORM::Catalog::Constraint]
|
|
19
20
|
|
|
20
|
-
def
|
|
21
|
+
def self.new: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::Catalog::Table table, Array[edit] edits, Array[Skyward::ORM::Catalog::Index] kept_indexes, Array[Skyward::ORM::Catalog::Constraint] kept_constraints) -> instance
|
|
22
|
+
| (klass: singleton(Skyward::ORM::Record), columns: Array[Skyward::ORM::Tables::Column], table: Skyward::ORM::Catalog::Table, edits: Array[edit], kept_indexes: Array[Skyward::ORM::Catalog::Index], kept_constraints: Array[Skyward::ORM::Catalog::Constraint]) -> instance
|
|
23
|
+
|
|
24
|
+
def self.members: () -> [ :klass, :columns, :table, :edits, :kept_indexes, :kept_constraints ]
|
|
25
|
+
|
|
26
|
+
def members: () -> [ :klass, :columns, :table, :edits, :kept_indexes, :kept_constraints ]
|
|
21
27
|
end
|
|
22
28
|
end
|
|
@@ -22,10 +22,10 @@ module Skyward::ORM::Migrations::Definitions
|
|
|
22
22
|
|
|
23
23
|
# The SQL that follows the column's DEFAULT, or nil when it has none.
|
|
24
24
|
# @rbs klass: singleton(Skyward::ORM::Record)
|
|
25
|
-
# @rbs column:
|
|
25
|
+
# @rbs column: Skyward::ORM::Tables::Column
|
|
26
26
|
# @rbs adapter: Skyward::ORM::_Adapter
|
|
27
27
|
# @rbs return: String?
|
|
28
|
-
def default: (singleton(Skyward::ORM::Record) klass,
|
|
28
|
+
def default: (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Tables::Column column, Skyward::ORM::_Adapter adapter) -> String?
|
|
29
29
|
|
|
30
30
|
# The constraint as a column's own, in a column's definition.
|
|
31
31
|
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
@@ -5,6 +5,26 @@ module Skyward::ORM::Migrations::Diff
|
|
|
5
5
|
|
|
6
6
|
NULL: String
|
|
7
7
|
|
|
8
|
+
RENAMABLE: Array[Skyward::ORM::Catalog::constraint_kind]
|
|
9
|
+
|
|
10
|
+
# A name as SQLite or PostgreSQL writes it, quoted or not.
|
|
11
|
+
NAME: Regexp
|
|
12
|
+
|
|
13
|
+
# A name with its schema, if it has one.
|
|
14
|
+
QUALIFIED: Regexp
|
|
15
|
+
|
|
16
|
+
# An index a class can declare: on columns alone, by PostgreSQL's btree,
|
|
17
|
+
# with no WHERE or INCLUDE, and not unique, since a class makes that only as
|
|
18
|
+
# a unique constraint.
|
|
19
|
+
PLAIN_INDEX: Regexp
|
|
20
|
+
|
|
21
|
+
# The columns a foreign key names after its table, if it names any.
|
|
22
|
+
REFERENCED: Regexp
|
|
23
|
+
|
|
24
|
+
QUOTED: Regexp
|
|
25
|
+
|
|
26
|
+
BY_VALUE: Array[Skyward::ORM::Tables::column_type]
|
|
27
|
+
|
|
8
28
|
# New tables come first, each after the tables it references, so a changed
|
|
9
29
|
# table can reference a new table too. A table with no class is left alone:
|
|
10
30
|
# a class that isn't loaded looks the same.
|
|
@@ -13,6 +33,16 @@ module Skyward::ORM::Migrations::Diff
|
|
|
13
33
|
# ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Array[Skyward::ORM::Migrations::change]
|
|
14
34
|
def changes: (Array[singleton(Skyward::ORM::Record)] classes, Skyward::ORM::Tables::ColumnTypes column_types, Array[Skyward::ORM::Catalog::Table] tables, Skyward::ORM::_Adapter adapter, ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Array[Skyward::ORM::Migrations::change]
|
|
15
35
|
|
|
36
|
+
# The indexes and constraints the table has that the class can't declare,
|
|
37
|
+
# which the diff neither drops nor adds. PostgreSQL puts a check on every
|
|
38
|
+
# column it mentions, so one the class declares is matched by its name first.
|
|
39
|
+
# @rbs klass: singleton(Skyward::ORM::Record)
|
|
40
|
+
# @rbs columns: Array[Skyward::ORM::Tables::Column]
|
|
41
|
+
# @rbs table: Skyward::ORM::Catalog::Table
|
|
42
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
43
|
+
# @rbs return: [Array[Skyward::ORM::Catalog::Index], Array[Skyward::ORM::Catalog::Constraint]]
|
|
44
|
+
def kept: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables) -> [ Array[Skyward::ORM::Catalog::Index], Array[Skyward::ORM::Catalog::Constraint] ]
|
|
45
|
+
|
|
16
46
|
private
|
|
17
47
|
|
|
18
48
|
# @rbs classes: Array[singleton(Skyward::ORM::Record)]
|
|
@@ -22,9 +52,9 @@ module Skyward::ORM::Migrations::Diff
|
|
|
22
52
|
# Indexes and constraints go before the columns they're on, and come back
|
|
23
53
|
# after the columns they need.
|
|
24
54
|
# @rbs (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns,
|
|
25
|
-
# Skyward::ORM::Catalog::Table table, Skyward::ORM::_Adapter adapter,
|
|
55
|
+
# Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables, Skyward::ORM::_Adapter adapter,
|
|
26
56
|
# ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Skyward::ORM::Migrations::AlterTable?
|
|
27
|
-
def altered: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::Catalog::Table table, Skyward::ORM::_Adapter adapter, ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Skyward::ORM::Migrations::AlterTable?
|
|
57
|
+
def altered: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::Catalog::Table table, Array[Skyward::ORM::Catalog::Table] tables, Skyward::ORM::_Adapter adapter, ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Skyward::ORM::Migrations::AlterTable?
|
|
28
58
|
|
|
29
59
|
# The indexes to drop and to add. One is compared by the columns it will
|
|
30
60
|
# have after any rename, and dropped as the database has it.
|
|
@@ -34,12 +64,15 @@ module Skyward::ORM::Migrations::Diff
|
|
|
34
64
|
# @rbs return: [Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit]]
|
|
35
65
|
def indexes: (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Catalog::Table table, Hash[Symbol, Symbol] renamed) -> [ Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit] ]
|
|
36
66
|
|
|
37
|
-
# The constraints to drop and to add, compared as indexes are. A
|
|
38
|
-
#
|
|
67
|
+
# The constraints to drop, to rename and to add, compared as indexes are. A
|
|
68
|
+
# foreign key or unique constraint the class declares that the table has
|
|
69
|
+
# under another name is renamed, from the first one if it has two, and the
|
|
70
|
+
# other is dropped. A new column's own constraints are part of its definition.
|
|
39
71
|
# @rbs (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns,
|
|
40
72
|
# Skyward::ORM::Catalog::Table table, Hash[Symbol, Symbol] renamed, Array[Skyward::ORM::Tables::Column] new_columns)
|
|
41
|
-
# -> [Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit]
|
|
42
|
-
|
|
73
|
+
# -> [Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit],
|
|
74
|
+
# Array[Skyward::ORM::Migrations::edit]]
|
|
75
|
+
def constraints: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::Catalog::Table table, Hash[Symbol, Symbol] renamed, Array[Skyward::ORM::Tables::Column] new_columns) -> [ Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit], Array[Skyward::ORM::Migrations::edit] ]
|
|
43
76
|
|
|
44
77
|
# Each column that went is asked about each new one of a compatible type, in
|
|
45
78
|
# order, until one is a rename. A column it renames to isn't asked about again.
|
|
@@ -47,7 +80,8 @@ module Skyward::ORM::Migrations::Diff
|
|
|
47
80
|
# Skyward::ORM::_Adapter adapter, ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Hash[Symbol, Symbol]
|
|
48
81
|
def renames: (Symbol table, Array[Skyward::ORM::Catalog::Column] removed, Array[Skyward::ORM::Tables::Column] added, Skyward::ORM::_Adapter adapter, ^(Symbol table, Symbol from, Symbol to) -> bool rename) -> Hash[Symbol, Symbol]
|
|
49
82
|
|
|
50
|
-
# An untyped column has no type or nullability to compare
|
|
83
|
+
# An untyped column has no type or nullability to compare, and a generated
|
|
84
|
+
# one no default.
|
|
51
85
|
# @rbs klass: singleton(Skyward::ORM::Record)
|
|
52
86
|
# @rbs column: Skyward::ORM::Tables::Column
|
|
53
87
|
# @rbs had: Skyward::ORM::Catalog::Column
|
|
@@ -55,16 +89,37 @@ module Skyward::ORM::Migrations::Diff
|
|
|
55
89
|
# @rbs return: Array[Skyward::ORM::Migrations::edit]
|
|
56
90
|
def changed: (singleton(Skyward::ORM::Record) klass, Skyward::ORM::Tables::Column column, Skyward::ORM::Catalog::Column had, Skyward::ORM::_Adapter adapter) -> Array[Skyward::ORM::Migrations::edit]
|
|
57
91
|
|
|
92
|
+
# PostgreSQL respells a jsonb default, as '{"a": 1}' for '{"a":1}', and a
|
|
93
|
+
# float array's, as '{1e+20}' for '{1.0e+20}', so a JSON or Array column's
|
|
94
|
+
# default is compared by value.
|
|
95
|
+
# @rbs (Skyward::ORM::Tables::Column column, String had, String wanted, Skyward::ORM::_Adapter adapter) -> bool
|
|
96
|
+
def same_default?: (Skyward::ORM::Tables::Column column, String had, String wanted, Skyward::ORM::_Adapter adapter) -> bool
|
|
97
|
+
|
|
98
|
+
# The value a string literal holds as the column reads it, in an Array so
|
|
99
|
+
# that JSON's null isn't taken for no value, or nil when it's an expression
|
|
100
|
+
# or the column can't read it.
|
|
101
|
+
# @rbs (Skyward::ORM::Tables::Column column, String default, Skyward::ORM::_Adapter adapter) -> [untyped]?
|
|
102
|
+
def value: (Skyward::ORM::Tables::Column column, String default, Skyward::ORM::_Adapter adapter) -> [ untyped ]?
|
|
103
|
+
|
|
58
104
|
# Constraints are matched by name. SQLite can hold one with no name, which
|
|
59
|
-
# matches the one its class declares
|
|
60
|
-
# a check's expression, and puts it on every column it mentions, so
|
|
61
|
-
# is matched by its name alone.
|
|
62
|
-
# ON DELETE.
|
|
105
|
+
# matches the one its class declares that does what it does. PostgreSQL
|
|
106
|
+
# rewrites a check's expression, and puts it on every column it mentions, so
|
|
107
|
+
# a check is matched by its name alone.
|
|
63
108
|
# @rbs had: Skyward::ORM::Catalog::Constraint
|
|
64
109
|
# @rbs wanted: Skyward::ORM::Catalog::Constraint
|
|
65
110
|
# @rbs return: bool
|
|
66
111
|
def same?: (Skyward::ORM::Catalog::Constraint had, Skyward::ORM::Catalog::Constraint wanted) -> bool
|
|
67
112
|
|
|
113
|
+
# @rbs had: Skyward::ORM::Catalog::Constraint
|
|
114
|
+
# @rbs wanted: Skyward::ORM::Catalog::Constraint
|
|
115
|
+
# @rbs return: bool
|
|
116
|
+
def renamed?: (Skyward::ORM::Catalog::Constraint had, Skyward::ORM::Catalog::Constraint wanted) -> bool
|
|
117
|
+
|
|
118
|
+
# @rbs had: Skyward::ORM::Catalog::Constraint
|
|
119
|
+
# @rbs wanted: Skyward::ORM::Catalog::Constraint
|
|
120
|
+
# @rbs return: bool
|
|
121
|
+
def alike?: (Skyward::ORM::Catalog::Constraint had, Skyward::ORM::Catalog::Constraint wanted) -> bool
|
|
122
|
+
|
|
68
123
|
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
69
124
|
# @rbs return: String
|
|
70
125
|
def on_delete: (Skyward::ORM::Catalog::Constraint constraint) -> String
|
|
@@ -76,6 +131,17 @@ module Skyward::ORM::Migrations::Diff
|
|
|
76
131
|
# @rbs return: bool
|
|
77
132
|
def same_index?: (Skyward::ORM::Catalog::Index had, Skyward::ORM::Catalog::Index wanted) -> bool
|
|
78
133
|
|
|
134
|
+
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
135
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
136
|
+
# @rbs return: bool
|
|
137
|
+
def declarable?: (Skyward::ORM::Catalog::Constraint constraint, Array[Skyward::ORM::Catalog::Table] tables) -> bool
|
|
138
|
+
|
|
139
|
+
# A reference that names no columns is to its table's primary key.
|
|
140
|
+
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
141
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
142
|
+
# @rbs return: bool
|
|
143
|
+
def to_primary_key?: (Skyward::ORM::Catalog::Constraint constraint, Array[Skyward::ORM::Catalog::Table] tables) -> bool
|
|
144
|
+
|
|
79
145
|
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
80
146
|
# @rbs added: Array[Skyward::ORM::Tables::Column]
|
|
81
147
|
# @rbs return: bool
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Generated from lib/skyward/orm/migrations/rename_constraint.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Skyward::ORM::Migrations
|
|
4
|
+
class RenameConstraint < Data
|
|
5
|
+
attr_reader from(): String
|
|
6
|
+
|
|
7
|
+
attr_reader to(): String
|
|
8
|
+
|
|
9
|
+
def self.new: (String from, String to) -> instance
|
|
10
|
+
| (from: String, to: String) -> instance
|
|
11
|
+
|
|
12
|
+
def self.members: () -> [ :from, :to ]
|
|
13
|
+
|
|
14
|
+
def members: () -> [ :from, :to ]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -11,6 +11,8 @@ module Skyward::ORM::Migrations::Runner
|
|
|
11
11
|
|
|
12
12
|
DOWN: Regexp
|
|
13
13
|
|
|
14
|
+
RAN_AT: Skyward::ORM::Tables::Column
|
|
15
|
+
|
|
14
16
|
# @rbs path: String
|
|
15
17
|
# @rbs return: Array[Migration]
|
|
16
18
|
def read: (String path) -> Array[Migration]
|
|
@@ -54,6 +56,9 @@ module Skyward::ORM::Migrations::Runner
|
|
|
54
56
|
# @rbs (Skyward::ORM::_Connection connection, Migration migration) { () -> (bool | Failed) } -> (bool | Failed)
|
|
55
57
|
def run_locked: (Skyward::ORM::_Connection connection, Migration migration) { () -> (bool | Failed) } -> (bool | Failed)
|
|
56
58
|
|
|
59
|
+
# @rbs (Skyward::ORM::_Adapter adapter, Skyward::ORM::_Connection connection) -> void
|
|
60
|
+
def end_migration: (Skyward::ORM::_Adapter adapter, Skyward::ORM::_Connection connection) -> void
|
|
61
|
+
|
|
57
62
|
# SQLite ends the transaction itself on some failures, such as ON CONFLICT
|
|
58
63
|
# ROLLBACK, and then ROLLBACK raises, though the outcome is already decided.
|
|
59
64
|
# @rbs (Skyward::ORM::_Connection connection) -> void
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Generated from lib/skyward/orm/migrations/script.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Skyward::ORM::Migrations::Script
|
|
4
|
+
# The column types of a primary key the database numbers.
|
|
5
|
+
NUMBERED: Array[Skyward::ORM::Tables::column_type]
|
|
6
|
+
|
|
4
7
|
# @rbs changes: Array[Skyward::ORM::Migrations::change]
|
|
5
8
|
# @rbs adapter: Skyward::ORM::_Adapter
|
|
6
9
|
# @rbs return: String
|
|
@@ -8,6 +11,14 @@ module Skyward::ORM::Migrations::Script
|
|
|
8
11
|
|
|
9
12
|
private
|
|
10
13
|
|
|
14
|
+
# A rebuild makes the table from its class, which can't say how the database
|
|
15
|
+
# generates a column, and the catalog keeps only a generated column's
|
|
16
|
+
# expression, not whether it's STORED, so the rebuild can't carry one over.
|
|
17
|
+
# @rbs changes: Array[Skyward::ORM::Migrations::change]
|
|
18
|
+
# @rbs adapter: Skyward::ORM::_Adapter
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def refuse_rebuilding_generated: (Array[Skyward::ORM::Migrations::change] changes, Skyward::ORM::_Adapter adapter) -> void
|
|
21
|
+
|
|
11
22
|
# @rbs change: Skyward::ORM::Migrations::change
|
|
12
23
|
# @rbs adapter: Skyward::ORM::_Adapter
|
|
13
24
|
# @rbs return: String
|
|
@@ -39,11 +50,12 @@ module Skyward::ORM::Migrations::Script
|
|
|
39
50
|
# @rbs return: String
|
|
40
51
|
def backward: (Skyward::ORM::Migrations::AlterTable change, Skyward::ORM::Migrations::edit edit) -> String
|
|
41
52
|
|
|
42
|
-
# SQLite rebuilds the table as its class has it
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
53
|
+
# SQLite rebuilds the table as its class has it, with what it keeps that the
|
|
54
|
+
# class can't declare: create the new one, copy the rows of each column it
|
|
55
|
+
# keeps, drop the old one, rename the new one and recreate its indexes.
|
|
56
|
+
# Dropping a table another one references would run that one's ON DELETE,
|
|
57
|
+
# so `skyward migrate` turns SQLite's foreign keys off around each
|
|
58
|
+
# migration, and checks them before it commits.
|
|
47
59
|
# @rbs change: Skyward::ORM::Migrations::AlterTable
|
|
48
60
|
# @rbs adapter: Skyward::ORM::_Adapter
|
|
49
61
|
# @rbs return: String
|
|
@@ -66,10 +78,16 @@ module Skyward::ORM::Migrations::Script
|
|
|
66
78
|
|
|
67
79
|
# Columns line up as a person would write them. A generated key's type runs
|
|
68
80
|
# on into its identity clause, so it doesn't set the width. A rebuild keeps
|
|
69
|
-
# the type an untyped column has.
|
|
81
|
+
# the type an untyped column has, and the constraints the class can't declare.
|
|
70
82
|
# @rbs (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns,
|
|
71
|
-
# Skyward::ORM::_Adapter adapter, Symbol name, Hash[Symbol, Skyward::ORM::Catalog::Column] kept
|
|
72
|
-
|
|
83
|
+
# Skyward::ORM::_Adapter adapter, Symbol name, Hash[Symbol, Skyward::ORM::Catalog::Column] kept,
|
|
84
|
+
# Array[Skyward::ORM::Catalog::Constraint] undeclared) -> String
|
|
85
|
+
def create_table: (singleton(Skyward::ORM::Record) klass, Array[Skyward::ORM::Tables::Column] columns, Skyward::ORM::_Adapter adapter, Symbol name, Hash[Symbol, Skyward::ORM::Catalog::Column] kept, Array[Skyward::ORM::Catalog::Constraint] undeclared) -> String
|
|
86
|
+
|
|
87
|
+
# SQLite can hold a constraint with no name.
|
|
88
|
+
# @rbs constraint: Skyward::ORM::Catalog::Constraint
|
|
89
|
+
# @rbs return: String
|
|
90
|
+
def table_constraint: (Skyward::ORM::Catalog::Constraint constraint) -> String
|
|
73
91
|
|
|
74
92
|
# @rbs klass: singleton(Skyward::ORM::Record)
|
|
75
93
|
# @rbs return: String
|
|
@@ -133,6 +151,12 @@ module Skyward::ORM::Migrations::Script
|
|
|
133
151
|
# @rbs return: String
|
|
134
152
|
def drop_constraint: (Symbol table, Skyward::ORM::Catalog::Constraint constraint) -> String
|
|
135
153
|
|
|
154
|
+
# @rbs table: Symbol
|
|
155
|
+
# @rbs from: String
|
|
156
|
+
# @rbs to: String
|
|
157
|
+
# @rbs return: String
|
|
158
|
+
def rename_constraint: (Symbol table, String from, String to) -> String
|
|
159
|
+
|
|
136
160
|
# The rows a table already has need a value for a new required column.
|
|
137
161
|
# @rbs klass: singleton(Skyward::ORM::Record)
|
|
138
162
|
# @rbs column: Skyward::ORM::Tables::Column
|
|
@@ -22,15 +22,24 @@ module Skyward::ORM::Migrations::Status
|
|
|
22
22
|
# @rbs return: Array[Symbol]
|
|
23
23
|
def unowned: (Array[Skyward::ORM::Catalog::Table] tables, Array[singleton(Skyward::ORM::Record)] classes) -> Array[Symbol]
|
|
24
24
|
|
|
25
|
+
# Each class whose table has what the class can't declare, with the name of
|
|
26
|
+
# each such index and constraint. SQLite can hold a constraint with no name.
|
|
27
|
+
# @rbs classes: Array[singleton(Skyward::ORM::Record)]
|
|
28
|
+
# @rbs column_types: Skyward::ORM::Tables::ColumnTypes
|
|
29
|
+
# @rbs tables: Array[Skyward::ORM::Catalog::Table]
|
|
30
|
+
# @rbs return: Array[[singleton(Skyward::ORM::Record), Array[String]]]
|
|
31
|
+
def kept: (Array[singleton(Skyward::ORM::Record)] classes, Skyward::ORM::Tables::ColumnTypes column_types, Array[Skyward::ORM::Catalog::Table] tables) -> Array[[ singleton(Skyward::ORM::Record), Array[String] ]]
|
|
32
|
+
|
|
25
33
|
# @rbs migrations: Array[[String, state]]
|
|
26
34
|
# @rbs changes: Array[Skyward::ORM::Migrations::change]
|
|
27
35
|
# @rbs unowned: Array[Symbol]
|
|
28
36
|
# @rbs return: bool
|
|
29
37
|
def clean?: (Array[[ String, state ]] migrations, Array[Skyward::ORM::Migrations::change] changes, Array[Symbol] unowned) -> bool
|
|
30
38
|
|
|
31
|
-
# @rbs (Array[[String, state]] migrations, Array[Skyward::ORM::Migrations::change] changes,
|
|
39
|
+
# @rbs (Array[[String, state]] migrations, Array[Skyward::ORM::Migrations::change] changes,
|
|
40
|
+
# Array[[singleton(Skyward::ORM::Record), Array[String]]] kept, Array[Symbol] unowned,
|
|
32
41
|
# Skyward::ORM::_Adapter adapter) -> String
|
|
33
|
-
def text: (Array[[ String, state ]] migrations, Array[Skyward::ORM::Migrations::change] changes, Array[Symbol] unowned, Skyward::ORM::_Adapter adapter) -> String
|
|
42
|
+
def text: (Array[[ String, state ]] migrations, Array[Skyward::ORM::Migrations::change] changes, Array[[ singleton(Skyward::ORM::Record), Array[String] ]] kept, Array[Symbol] unowned, Skyward::ORM::_Adapter adapter) -> String
|
|
34
43
|
|
|
35
44
|
private
|
|
36
45
|
|
|
@@ -43,6 +52,10 @@ module Skyward::ORM::Migrations::Status
|
|
|
43
52
|
# @rbs return: String
|
|
44
53
|
def listing: (Array[[ String, state ]] migrations) -> String
|
|
45
54
|
|
|
55
|
+
# @rbs kept: Array[[singleton(Skyward::ORM::Record), Array[String]]]
|
|
56
|
+
# @rbs return: String
|
|
57
|
+
def kept_text: (Array[[ singleton(Skyward::ORM::Record), Array[String] ]] kept) -> String
|
|
58
|
+
|
|
46
59
|
# @rbs unowned: Array[Symbol]
|
|
47
60
|
# @rbs return: String
|
|
48
61
|
def unowned_text: (Array[Symbol] unowned) -> String
|
|
@@ -43,7 +43,6 @@ module Skyward::ORM::Migrations::Summary
|
|
|
43
43
|
# @rbs return: String
|
|
44
44
|
def constraint: (Skyward::ORM::Catalog::Constraint constraint) -> String
|
|
45
45
|
|
|
46
|
-
# An index on an expression has no columns to name.
|
|
47
46
|
# @rbs index: Skyward::ORM::Catalog::Index
|
|
48
47
|
# @rbs return: String
|
|
49
48
|
def index: (Skyward::ORM::Catalog::Index index) -> String
|