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

Use the table prefix on metric_points #2960

Merged
merged 1 commit into from
Mar 26, 2018

Conversation

nalysius
Copy link
Contributor

In the '.env' file, a 'DB_PREFIX' sets the prefix that should be used
on every table name. When writing an SQL query the 'DB_PREFIX' value
has to be prefixed to the table name.

The repositories PgSqlRepository, MySqlRepository and SqliteRepository,
located in 'app/Repositories/Metric/' did not apply this prefix on
the 'metric_points' table. The problem occured only when we set a
'DB_PREFIX' not null, the rest of the application worked correctly but
the part about 'metric_points' couldn't work, saying the table was
inexistant.

A method was added in the repository AbstractMetricRepository to get
the 'metric_points' table name with the prefix if there is one.
This method is used in the three repositories to get the right table
name.

Note: This problem was present in 2.3, but was already fixed in 2.4 so
there is no need to apply this commit on the 2.4 branch.

See: CachetHQ/Cachet/#2955

In the '.env' file, a 'DB_PREFIX' sets the prefix that should be used
on every table name. When writing an SQL query the 'DB_PREFIX' value
has to be prefixed to the table name.

The repository PgSqlRepository, MySqlRepository and SqliteRepository,
located in 'app/Repositories/Metric/' did not apply this prefix on
the 'metric_points' table. The problem occured only when we set a
'DB_PREFIX' not null, the rest of the application worked correctly but
the part about 'metric_points' couldn't work, saying the table was
inexistant.

A method was added in the repository AbstractMetricRepository to get
the 'metric_points' table name with the prefix if there is one.
This method is used in the three repositories to get the right table
name.

Note: This problem was present in 2.3, but was already fixed in 2.4 so
there is no need to apply this commit on the 2.4 branch.

See: CachetHQ/Cachet/cachethq#2955
@jbrooksuk
Copy link
Member

I wish we could have used Eloquent for this, it'd have saved so many headaches.

@jbrooksuk
Copy link
Member

By the way, thank you for fixing this. I'll tag a v2.3 release.

@jbrooksuk jbrooksuk merged commit 83bc743 into cachethq:2.3 Mar 26, 2018
@welcome
Copy link

welcome bot commented Mar 26, 2018

Hooray! Your first Pull Request was merged, here's to many more 🚀

@nalysius
Copy link
Contributor Author

In 2.3 (or 3.0, we'd say that in the roadmap) we could use Eloquent for all queries.

@Naramsim
Copy link

Please, update the docker image on Docker Hub. It contains this bug. @anthonybocci @jbrooksuk

@jbrooksuk
Copy link
Member

@djdefi is responsible for the Docker image :)

@jbrooksuk jbrooksuk added this to the V2.3.14 milestone May 9, 2019
@nalysius nalysius deleted the metric-points-prefix-table-2925 branch May 18, 2019 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants