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

add/remove_foreign_key do not work on temporal tables #174

Open
tagliala opened this issue Jul 24, 2022 · 2 comments
Open

add/remove_foreign_key do not work on temporal tables #174

tagliala opened this issue Jul 24, 2022 · 2 comments
Labels
bug CRITICAL Critical issues

Comments

@tagliala
Copy link
Member

add_foreign_key :countries, :regions
== 20220724104350 AddRegionFkConstraints: migrating ===========================
-- add_foreign_key(:countries, :regions)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::WrongObjectType: ERROR:  "countries" is not a table or foreign table
@tagliala tagliala changed the title add_foreign_key do not work on temporal tables add/remove_foreign_key do not work on temporal tables Jul 24, 2022
@tagliala tagliala added the bug label Jul 24, 2022
tagliala added a commit that referenced this issue Jul 26, 2022
@tagliala
Copy link
Member Author

Unfortunately

      def add_foreign_key(table_name, *)
        return super unless is_chrono?(table_name)
        on_temporal_schema { super }
      end

will not work in this case because if you want to add a foreign key between a temporal table and a normal table, on_temporal_schema will assume that both tables are temporal, but this cannot be true, so this requires some kind of custom logic that I cannot figure out at the moment

@tagliala tagliala added the CRITICAL Critical issues label Nov 5, 2022
@Zyndoras
Copy link

Is there currently any other way of adding a reference to a temporal: true-table aside from dropping and recreating the table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CRITICAL Critical issues
Projects
None yet
Development

No branches or pull requests

2 participants