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 support for enums schema in Postgresql #1171

Closed
TatriX opened this issue Apr 14, 2021 · 5 comments
Closed

Add support for enums schema in Postgresql #1171

TatriX opened this issue Apr 14, 2021 · 5 comments

Comments

@TatriX
Copy link

TatriX commented Apr 14, 2021

Hi!
As far as I can tell, right now it's impossible to use enums in schema other then public.

It would be very helpful if one could specify schema as well, perhaps like this:

#[derive(sqlx::Type)]
#[sqlx(type_name = "scope", schema = "olives")]
pub enum Scope {
    Flowering,
    OilSampling,
    Harvest,
    Structure
}
realaravinth added a commit to realaravinth/gitpad that referenced this issue Feb 14, 2022
…thods

The following changes are implemented for both db-sqlx-postgres and
db-sqlx-sqlite:

TABLE gists_gists
    Stores gist metadata with unique index on gists_gists.public_id for fast
    lookups

TABLE gists_comments
    Stores comment metadata

TABLE gists_privacy
    Stores gist privacy: sqlx currently doesn't have support Postgres
    enums(ref: launchbadge/sqlx#1171), so storing
    possible privacy values as references from this table.

    This table shouldn't be mutated during runtime. Possible values are
    already recorded in database during migrations. All runtime operations
    on this table must only take references.

    Each implementation of GistDatabase also includes a method called
    privacy_exists, which is called during tests to ensure that
    migrations are successful.

VIEW gists_gists_view
    Gist lookups combines data from gists_users, gists_gists and
    gists_privacy. This SQL view boots performance(I think?). At any rate,
    it is much nicer to work with.

QUIRKS
    Database indexes are i64 in SQLite while i32 in Postgres
realaravinth added a commit to realaravinth/gitpad that referenced this issue Feb 14, 2022
…thods

The following changes are implemented for both db-sqlx-postgres and
db-sqlx-sqlite:

TABLE gists_gists
    Stores gist metadata with unique index on gists_gists.public_id for fast
    lookups

TABLE gists_comments
    Stores comment metadata

TABLE gists_privacy
    Stores gist privacy: sqlx currently doesn't have support Postgres
    enums(ref: launchbadge/sqlx#1171), so storing
    possible privacy values as references from this table.

    This table shouldn't be mutated during runtime. Possible values are
    already recorded in database during migrations. All runtime operations
    on this table must only take references.

    Each implementation of GistDatabase also includes a method called
    privacy_exists, which is called during tests to ensure that
    migrations are successful.

VIEW gists_gists_view
    Gist lookups combines data from gists_users, gists_gists and
    gists_privacy. This SQL view boots performance(I think?). At any rate,
    it is much nicer to work with.

QUIRKS
    Database indexes are i64 in SQLite while i32 in Postgres
@mara-schulke
Copy link

Please implement this

@kulame
Copy link

kulame commented Oct 14, 2022

how is it going?

@jenyaftw
Copy link

Any updates?

@Diggsey
Copy link
Contributor

Diggsey commented Aug 8, 2024

It looks like this was fixed in #3252 ?

@abonander
Copy link
Collaborator

Yep, if anyone still has a problem feel free to open a new issue.

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

No branches or pull requests

6 participants