rebus-org / Rebus.Oracle

:bus: Oracle transport for Rebus
https://mookid.dk/category/rebus
Other
5 stars 10 forks source link

Refactor schema creation #21

Closed jods4 closed 5 years ago

jods4 commented 5 years ago

This is done on top of #18

I have refactored all schema creation code into a new class. It helps keeping the other classes more focused and reduces duplication a bit.

👉 I made it public, so that it can be used to create the schema at another time / with another user.

👉 I also moved all DDL statements in a single file with nothing else, so that they are easy to pick up if someone wants to create the schema through another mean (e.g. running scripts manually with an admin user). Security best practices ;)

❌ The scripts (and code for that matter) are full of inconsistencies (e.g. varchar vs nvarchar2, naming, ...) but this PR does not change them.

👉 I changed the way existing tables are detected to make it a lot more efficient in large schemas.

Above changes fix #10.

👉 I added a flag to not create automatically the transport schema. Somehow, it was the only part that did not have such a flag (did I say consistency?).

👉 I added support for 2-part names such as Rebus.Saga.

This is useful if you want to re-use the same Oracle connections as your application code but still keep each app and rebus in their own schema (instead of opening 2 connections with different users). But the real motivation is in preparation of #13. When you enlist with the app's own logic, you won't have an option to open different connections anymore.

📢 Rebus.Saga works but take notice:

❌ Quoted names like Rebus."Saga Snapshot" did not work before, they still don't.

✔️ 79/79 tests green