Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle producer add missing functions #143

Merged
merged 19 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ca601db
Added support for CURRENT_TIMESTAMP as a default value when parsing O…
hazardv Aug 10, 2022
0d8ce8f
Added tests to verify changes to oracle parser.
hazardv Aug 10, 2022
dbd1da1
Split the creation of contraints out from the creation of the table a…
hazardv Aug 18, 2022
929ae33
Missing a few small things
hazardv Aug 18, 2022
ed59a4d
Added drop_field to Oracle.pm and added alter constraint testing.
hazardv Aug 19, 2022
cdb544f
Added drop_table functionality along with related tests.
hazardv Aug 22, 2022
22a15de
Make sure the sqlt_args actually get passed in to the SQL::Translator…
hazardv Aug 24, 2022
ab42ef8
Removed batch alter stuff from Oracle.pm. It was just complicating th…
hazardv Aug 24, 2022
df7e62f
All quoting is working consistent to how it works for MySQL and SQLSe…
hazardv Aug 25, 2022
c90a599
Fixed issue with drop FK constraint syntax
hazardv Sep 7, 2022
b371f16
Fixed restriction stopping change of NOT NULL to NULL for non CLOB fi…
hazardv Sep 8, 2022
b14da74
Removed commented out section of code.
hazardv Sep 9, 2022
d2d080c
fixed issue with alter_drop_constraint when dropping unnamed primary …
hazardv Sep 26, 2022
2d47b5c
Reverted change to passing of $options and fixed test plan.
hazardv Sep 29, 2022
b4a8ca7
Added debug statements to figure out constraint order issue
hazardv Oct 5, 2022
a32992d
Separated FK_defs out so things would play nice and modified 51-xml-t…
hazardv Oct 5, 2022
090b5b4
Corrected quoting on index fields, updated 51-xml-to-oracle_quoted.t …
hazardv Oct 5, 2022
74c0312
Corrected changes previously made to 55-oracle-producer.t in error.
hazardv Oct 5, 2022
2a66d69
Removed some unnecessary debug comments.
hazardv Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/SQL/Translator/Producer/Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,13 @@ sub alter_drop_constraint {
my ($c, $options) = @_;
my $qi = $options->{quote_identifiers};
my $table_name = quote($c->table->name, $qi);

my @out = ('ALTER','TABLE',$table_name,'DROP','CONSTRAINT',quote($c->name, $qi));
my @out = ('ALTER','TABLE',$table_name,'DROP',);
if ($c->name) {
push @out, ('CONSTRAINT',quote($c->name, $qi));
}
elsif ($c->type eq PRIMARY_KEY) {
push @out, 'PRIMARY KEY';
}
return join(' ',@out);
}

Expand Down
2 changes: 2 additions & 0 deletions t/54-oracle-sql-diff.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ ok($diff, 'Diff generated.');

like($diff, '/CREATE TABLE t_group/', 'CREATE TABLE t_group generated');

like($diff, '/ALTER TABLE t_category DROP PRIMARY KEY/', 'Drop PRIMARY KEY generated');

like($diff, '/ALTER TABLE t_category DROP CONSTRAINT t_category_display_name/', 'DROP constraint t_category_display_name generated');

like($diff, '/ALTER TABLE t_user_groups DROP CONSTRAINT t_user_groups_group_id_fk/', 'DROP FOREIGN KEY constraint generated');
Expand Down
8 changes: 4 additions & 4 deletions t/data/oracle/schema-1.6.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
CREATE TABLE t_category (
category_id number(11) NOT NULL,
id number(11) NOT NULL,
display_name varchar2(256) NOT NULL,
description varchar2(4000) NOT NULL,
added date DEFAULT CURRENT_TIMESTAMP NOT NULL,
added_by varchar2(32) NOT NULL,
modified date,
modified_by varchar2(32),
PRIMARY KEY (category_id)
PRIMARY KEY (id)
);

CREATE SEQUENCE sq_t_group_group_id;
Expand Down Expand Up @@ -121,9 +121,9 @@ CREATE TABLE t_alert_roles (
PRIMARY KEY (alert_id, role_id)
);

ALTER TABLE t_alert ADD CONSTRAINT t_alert_category_fk FOREIGN KEY (category) REFERENCES t_category (category_id);
ALTER TABLE t_alert ADD CONSTRAINT t_alert_category_fk FOREIGN KEY (category) REFERENCES t_category (id);

ALTER TABLE t_category_defaults ADD CONSTRAINT t_category_defaults_category FOREIGN KEY (category_id) REFERENCES t_category (category_id);
ALTER TABLE t_category_defaults ADD CONSTRAINT t_category_defaults_category FOREIGN KEY (category_id) REFERENCES t_category (id);

ALTER TABLE t_category_defaults ADD CONSTRAINT t_category_defaults_user_id FOREIGN KEY (user_id) REFERENCES t_user (user_id);

Expand Down