-
|
In the project i'm on, we are in the midst of switching from an old database to a new database. Old is HSP and new is FPMA (for referencing below). I'm needing to create a new page based on the new database that lists the projects in the new database. The old db had projects but the table was called something else. So the projects.cfc controller simply used the following to get the list of all projects. The Project.cfc model config would simply set the table name using the table() function as the table was not called "projects" in the old db. I'm now trying to use the dataSource() function to override the data source name to use the new DSN FPMA, but it's not working for my new page. I change the config contents for Project.cfc model to be: and in the new Projects.cfc controller index action, I first off call that same line above: But now it throws an error saying there is no projects table in the database. There is in FPMA but not in HSPTest. I think there is an issue here. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
|
I haven't really used Are you reloading the app after making these changes? I mentioned to you on Slack that the config() function is cached. Another thought is an alternative method, which may or may not be more suitable depending on your use case... but it might be better in the long run (if potentially require more code changes): Instead of setting the Model B (the new one) could potentially extend Model A (legacy) so you could take advantages of not duplicating model methods too, in principle. /models/Project.cfc /models/new/Project.cfc You could also just have it in the root directory, but you'd need a different CFC name obviously. (Also you don't have to extend the original model if you don't want to, you could just extend Then in your controller methods, you could switch which model you're calling dependent on some condition. I guess you could also use a helper function in then: Lastly, you could override the core By keeping the models seperate, you could then also start having additional fields/custom behaviour on the second model. All code/ideas above provided off the top of my head without testing :) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
It seems to resolved, I'm gonna close this. Please review the #1411 for further details. |
Beta Was this translation helpful? Give feedback.

After changing the DSN setting to use only one (the new) databae with no overrides, I still got the same error message, table not found! With two other developers here not having this issue suggests that something was unique to my environment. So I dug into the /wheels source code with debug dumps to narrow down where the error was coming from. I narrowed it down to a tag failure which is native CFML tag so then I knew the issue was in my database connection. However, the DS setup has been working fine in CF Admin, with no errors reported there. So I started comparing with others db configuration and checking security settings in SSMS app and found the problem:
I did not have the members…