crossplane-contrib / provider-sql

An SQL provider for @crossplane
https://crossplane.io
Apache License 2.0
104 stars 59 forks source link

Managed database schemas #51

Open negz opened 3 years ago

negz commented 3 years ago

What problem are you facing?

It would be ideal to support managing database schemas declaratively using this provider.

How could Crossplane help solve your problem?

Add a Schema managed resource to this provider? I'd love to see a sketch of what that managed resource would look like as YAML. We could probably take inspiration from https://github.com/schemahero/schemahero here.

poojaac commented 2 years ago

Any updates on adding support for creating schemas?

dneves commented 1 year ago

so i'm using this provider to create a database and a role in AWS RDS instances. i'm able to do it, and also set the role as the owner of the database.

but, due to how AWS setups RDS (ie, master user is not a superuser and new roles are not owners of db schemas), i also need to change the schema owner (to the new role i'm creating). the command i need to issue is:

ALTER SCHEMA public OWNER TO <role>;

note: need to connect to the database first with the master/root user

as far as i understand from looking at the provider code, neither Database or Grant supports this use case. is anyone using this kind of stuff on AWS RDS? how are you configuring this stuff ?

i might be able to contribute to the provider, but would like to first talk with its maintainers to understand the best way to go about this:

thank you.

Bastichou commented 1 year ago

Hi,

I'm also interested on this feature, being able to manage Postgre schemas on a RDS cluster. I suppose adding a Schema object would be nice ? Not sure you need any reference to the Schema on the Database ? The Schema owner would be set on the Schema specs ?

chlunde commented 3 months ago

@Bastichou, @dneves - see PR #181 for CREATE SCHEMA support (including owner).

I think @negz is talking about a full fledged schema hero replacement (Table etc)