Commit Graph

44 Commits

Author SHA1 Message Date
Aiden Foxx
27037f95c7 Fix quotes with schema default values (#6968)
* Added quote trimming to schema default values

* Add return type to stripQuotes function

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-07-26 16:37:45 +00:00
Aiden Foxx
6283b649f5 Removed lowercase remap from Oracle schema (#6214) 2021-06-11 12:54:46 -04:00
Aiden Foxx
ec72249ab5 Optimized oracle schema overview query (#6211)
* Optimized oracle schema overview query

* Fixed oracle overview query indentation
2021-06-11 11:22:59 -04:00
rijkvanzanten
2cce775784 Fix sqlite import 2021-06-03 23:40:34 -04:00
Rijk van Zanten
fe6101cfd3 Fix unsigned data type reading in MSSQL (#6058)
Fixes #5999
2021-06-03 23:11:15 -04:00
Rijk van Zanten
85d33d9ffc Fixed an issue that would cause "text" fields to show up as varchar with length -1 in MS SQL (#6055)
Fixes #5944
2021-06-03 22:35:07 -04:00
Matteo Gazzoni
32f4fcf0c7 select only real tables (and not views) in mssql (#5816)
* select only real tables (and not views) in mssql

* add table_catalog check

* Add changeset

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-21 21:11:19 +00:00
Rijk van Zanten
9335372400 Foreign Key Constraints (#5615)
* Bump knex-schema-inspector

* Fix cli role name attr

* Update relation type

* Restructure relations

* Restructure relations table

* Update api type for relation record

* Fetch relations in new structure

* Update schema-inspector

* Use new relations schema structure in api

* Update relations GETters

* Add default value to one deselect

* Add create relationship on existing field

* Add updating existing relationship

* Add delete relations

* Add relations query resolver

* Add graphql mutations for relations

* Fix reading from wrong name

* Fix wrong method name

* No idea why this flip flops every install

* Update relation type

* Accept null in use-collection composable

* Use new relations structure in translations

* Use new relations structure in new-collection

* Start updating field detail store

* Renames for new relations structure

* Silently ignore passed collection/field in relation update

* Fix setting pk field in m2o relational setup

* Small tweaks in o2m setup

* Fix m2m setup

* Tweak m2o setup

* Fix m2a setup

* Allow null for related collection (m2a)

* Fix languages code name

* Fix migration default value

* Fix relational cleanup in collections/fields

* Fix transaction problem in field delete

* Fix inserting relational o2m items

* Don't execute updateByQuery on empty item set

Fixes #5710, fixes #5070

* Show referential action input on m2o

* Finish language for m2o

* Show triggers config on o2m

* Delete items on one_deselect_item delete

* Fix naming, show relational trigger config on m2m

* Tweak language, add setup to m2a

* Fix linter warnings

* Add trigger setup for translations

* fix Edit non-schema relationship issue

* Sync existing on_delete triggers in o2m setup

* Add migration to setup foreign key constraints

* Update illegal FK values before setting constraint

* Fix MySQL unsigned vs not-unsigned in FK creation

* Use pretty names for labels in relational triggers

* Prefix auto-junction when system table

Fixes #5493

* Add system foreign key triggers

Fixes #5749

* Update docs
2021-05-19 12:29:16 -04:00
rijkvanzanten
8e8f93ac62 Pull parseDefaultValue from new location
Fixes #5733
2021-05-17 15:36:39 -04:00
Oreille
da1c3ed9a3 Added support for PostgreSQL identity column (#5502) 2021-05-05 17:52:41 -04:00
Aiden Foxx
f9a01d6684 [OracleDB] Extended schema-inspector to add AUTO_INCREMENT to columnInfo (#5408)
* Extended knex to add AUTO_INCREMENT to oracle columnInfo

* TS: Added missing return type
2021-05-03 09:34:45 -04:00
rijkvanzanten
801e868554 Fix remaining eslint errors
h/t @paescuj
2021-04-29 15:55:12 -04:00
Pascal Jufer
acd41eb0be Syntax fixes (#5367)
* Declare return types on functions

And a very few other type related minor fixes

* Minor syntax fixes

* Remove unnecessary escape chars in regexes
* Remove unnecessary awaits
* Replace deprecated req.connection with req.socket
* Replace deprecated upload with uploadOne
* Remove unnecessary eslint-disable-next-line comments
* Comment empty functions / catch or finally clauses
* Fix irregular whitespaces
* Add missing returns (null)
* Remove unreachable code
* A few logical fixes
* Remove / Handle non-null assertions which are certainly unnecessary (e.g. in
tests)
2021-04-29 12:11:43 -04:00
Aiden Foxx
da826e2a1a Update oracledb.ts (#5331)
As explained in the code comment, Oracle doesn't return "AUTO_INCREMENT", causing `authorization.ts` to throw a error that primary keys are required values.
2021-04-28 14:07:15 -04:00
Aiden Foxx
dc973d37f4 Update oracledb.ts (#5327)
As defined by Oracle, NULLABLE should return "Y" or "N":

https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2094.htm
2021-04-28 14:53:17 +00:00
rijkvanzanten
c4e1e40279 Fix @directus/schema not reading Oracle overview correctly
Fixes #4735
2021-04-09 19:28:00 -04:00
Stephen O'Connor
bb9b39187b Remove semi-colon to avoid ORA-00933 (#4726) 2021-03-29 08:59:34 -04:00
rijkvanzanten
340aa2deef Fix MySQL not correctly scoping columns to database 2021-03-16 11:26:57 -04:00
Adrian Dimitrov
51a0044d7f In mysql, select only tables (#4501) 2021-03-12 18:12:18 -05:00
Martijn Boland
9897e3d39e Added 'AUTO_INCREMENT' for mssql identity columns (#4494)
* Added 'AUTO_INCREMENT' for mssql identity columns

* Removed obsolete method

Co-authored-by: Martijn Boland <martijn@taiga.nl>
2021-03-11 18:09:06 -05:00
Rijk van Zanten
971a18c219 Database Error Abstraction (#4465)
* Start on database-error abstraction layer

* Add SQLite error abstraction

* Enable SQLite foreign key support

* Cleanup sqlite dialect slightly

Does it matter? Not really!

* Add MySQL error abstraction

* WIP Almost done with MSSQL

* Add correct error handling for MS SQL

* Fix mysql errors by not relying on value order

* Don't rely on sql in postgres exception translation

* Fix sqlite error parsing

* Remove foreign key constraint from activity to collections

A collection can be DB-only, but we still want to track activity for non-meta collections

* Translate error on update as well
2021-03-10 17:16:15 -05:00
Rijk van Zanten
97dcdad847 OracleDB baby steps (#4464)
* Allow external connections in oracle debug

* Fix oracle overview query

* Use correct alive check for oracle

* Remove unused import

* Validate correct env vars for oracle
2021-03-10 16:58:49 -05:00
Rijk van Zanten
291643e0b4 Fix installing on MS SQL (#4455)
Fixes #3158, fixes #3608
2021-03-09 18:43:03 -05:00
Rijk van Zanten
1db99e0828 Cleanup schema inspector (#4404)
* Rely on knex-schema-inspector

* Update packages
2021-03-05 17:06:07 -05:00
Nicola Krumschmidt
08293b8570 Update Knex to version 0.95.0 (#4374)
* Update Knex to version 0.95.0

* Fix formatting in schema dialects

* Fix Knex imports

* Update package-lock

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-03-03 19:37:44 -05:00
rijkvanzanten
eb4deaa955 Default field sort order to database ordinal sort
And use alphabetical where appropriate

Fixes #4341
2021-03-03 18:36:21 -05:00
Kim Streich
c30078369a Fix MS SQL init failure due to uquoted DB name 2021-01-23 20:13:43 +04:00
rijkvanzanten
ea3fb22322 Wrap db name
Fixes #3607
2021-01-13 16:07:05 -05:00
rijkvanzanten
7032eb4797 Check for both column key and constraint name
Fixes #3322
2021-01-12 17:59:16 -05:00
Rijk van Zanten
fd99c2d3ef Merge pull request #3250 from nickrum/postgres-nullable-fix
Fix nullable property of Postgres schema overview
2020-11-30 18:32:36 -05:00
Nicola Krumschmidt
41ea26b143 Fix nullable property of Postgres schema overview 2020-12-01 00:18:57 +01:00
Nicola Krumschmidt
4428aebe92 Fix default value of SQLite schema overview
Fixes #3186
2020-12-01 00:06:05 +01:00
Samuli Asmala
ba4605752b Only select columns from BASE TABLEs to exclude views
Postgres views cannot have primary keys so presence of any views prevented the use of application. Fixes #3229.
2020-11-30 11:57:37 +02:00
rijkvanzanten
a9ffc40979 Fix schema not handling uppercases in PG
Fixes #3213
2020-11-27 19:31:25 -05:00
rijkvanzanten
0c0f0e443c Use PG current_database() instead of connection param 2020-11-10 17:53:41 -05:00
rijkvanzanten
f01e59707b Fix auto-increment in schema overview 2020-11-10 13:59:43 -05:00
rijkvanzanten
4d09f4a07e Add oracle/mssql 2020-11-09 18:50:08 -05:00
rijkvanzanten
64d34933d1 Add overview method for SQLite3 2020-11-09 18:37:00 -05:00
rijkvanzanten
56979b3ae3 Add overview support to mysql 2020-11-09 18:20:37 -05:00
rijkvanzanten
2b602c15e3 Small fixes 2020-11-09 17:20:42 -05:00
rijkvanzanten
8cbdfb409b Use prefetched schema info 2020-11-09 17:13:48 -05:00
rijkvanzanten
0697f4b4be Add new overview method, attach it every request 2020-11-09 15:19:23 -05:00
rijkvanzanten
528112314d Remove outdated tests, fix imports 2020-11-09 12:29:01 -05:00
rijkvanzanten
427bd8564e Include schema package 2020-11-09 11:21:43 -05:00