%syntax-version=1.0.0 %project=numerus %uri=https://numerus.tandem.blog/ roles 2023-01-12T18:42:16Z jordi fita mas # Add database roles schema_auth [roles] 2023-01-12T19:15:55Z jordi fita mas # Add authentication schema schema_public [roles] 2023-01-12T19:24:29Z jordi fita mas # Set privileges to public schema schema_numerus [roles] 2023-01-12T22:57:22Z jordi fita mas # Add application schema extension_citext [schema_public] 2023-01-12T23:03:33Z jordi fita mas # Add citext extension email [schema_numerus extension_citext] 2023-01-12T23:09:59Z jordi fita mas # Add email domain language [schema_numerus] 2023-01-21T20:55:49Z jordi fita mas # Add relation of available languages user [roles schema_auth email language] 2023-01-12T23:44:03Z jordi fita mas # Create user relation ensure_role_exists [schema_auth user] 2023-01-12T23:57:59Z jordi fita mas # Add trigger to ensure the user’s role exists extension_pgcrypto [schema_auth] 2023-01-13T00:11:50Z jordi fita mas # Add pgcrypto extension encrypt_password [schema_auth user extension_pgcrypto] 2023-01-13T00:14:30Z jordi fita mas # Add trigger to encrypt user’s password login_attempt [schema_auth] 2023-01-17T14:05:49Z jordi fita mas # Add relation to log login attempts login [roles schema_numerus schema_auth extension_pgcrypto email user login_attempt] 2023-01-13T00:32:32Z jordi fita mas # Add function to login current_user_cookie [schema_numerus] 2023-01-21T20:16:28Z jordi fita mas # Add function to get the cookie of the current Numerus’ user current_user_email [schema_numerus] 2023-01-23T19:11:53Z jordi fita mas # Add function to get the email of the current Numerus’ user build_cookie [schema_numerus current_user_email current_user_cookie] 2023-01-23T19:46:13Z jordi fita mas # Add function to build the cookie for the current user check_cookie [schema_public user build_cookie] 2023-01-17T17:48:49Z jordi fita mas # Add function to check if a user cookie is valid logout [schema_auth current_user_email current_user_cookie user] 2023-01-17T19:10:21Z jordi fita mas # Add function to logout set_cookie [schema_public check_cookie] 2023-01-19T11:00:22Z jordi fita mas # Add function to set the role based on the cookie available_languages [schema_numerus language] 2023-01-21T21:11:08Z jordi fita mas # Add the initial available languages user_profile [schema_numerus user current_user_email current_user_cookie] 2023-01-21T23:18:20Z jordi fita mas # Add view for user profile change_password [schema_numerus user] 2023-01-23T20:22:45Z jordi fita mas # Add function to change the current user’s password extension_vat [schema_public] 2023-01-24T10:28:17Z jordi fita mas # Add vat extension extension_pg_libphonenumber [schema_public] 2023-01-24T13:50:14Z jordi fita mas # Add extension for phone numbers extension_uri [schema_public] 2023-01-24T14:29:29Z jordi fita mas # Add extension for URIs currency_code [schema_numerus] 2023-01-24T14:36:04Z jordi fita mas # Add the domain for currency code in ISO 4217 currency [schema_numerus currency_code] 2023-01-24T14:45:26Z jordi fita mas # Add the relation for currencies available_currencies [schema_numerus currency] 2023-01-24T14:54:18Z jordi fita mas # Add the initial list of available currencies country_code [schema_numerus] 2023-01-27T18:33:26Z jordi fita mas # Add domain for country codes country [schema_numerus country_code] 2023-01-27T18:39:44Z jordi fita mas # Add the relation for countries country_i18n [schema_numerus country_code language country] 2023-01-27T19:20:43Z jordi fita mas # Add table for localization of country names available_countries [schema_numerus country country_i18n] 2023-01-27T18:49:28Z jordi fita mas # Add the list of available countries company [schema_numerus extension_vat email extension_pg_libphonenumber extension_uri currency_code currency country_code country] 2023-01-24T15:03:15Z jordi fita mas # Add the relation for companies company_user [schema_numerus user company] 2023-01-24T17:50:06Z jordi fita mas # Add the relation of companies and their users tax_rate [schema_numerus] 2023-01-28T11:33:39Z jordi fita mas # Add domain for tax rates tax [schema_numerus company tax_rate] 2023-01-28T11:45:47Z jordi fita mas # Add relation for taxes contact [schema_numerus company extension_vat email extension_pg_libphonenumber extension_uri currency_code currency country_code country] 2023-01-29T12:59:18Z jordi fita mas # Add the relation for contacts product [schema_numerus company tax] 2023-02-04T09:17:24Z jordi fita mas # Add relation for products parse_price [schema_public] 2023-02-05T11:04:54Z jordi fita mas # Add function to convert from price to cents to_price [schema_numerus] 2023-02-05T11:46:31Z jordi fita mas # Add function to format cents to prices invoice_status [schema_numerus] 2023-02-07T14:50:26Z jordi fita mas # A relation of invoice status invoice_status_i18n [schema_numerus invoice_status language] 2023-02-07T14:56:18Z jordi fita mas # Add relation for invoice status’ translatable texts available_invoice_status [schema_numerus invoice_status invoice_status_i18n] 2023-02-07T15:07:06Z jordi fita mas # Add the list of available invoice status product_tax [schema_numerus product tax] 2023-02-08T11:36:49Z jordi fita mas # Add relation of product taxes invoice [schema_numerus company contact invoice_status currency] 2023-02-09T09:52:21Z jordi fita mas # Add relation for invoice discount_rate [schema_numerus] 2023-02-10T17:22:40Z jordi fita mas # Add domain for discount rates invoice_product [schema_numerus invoice discount_rate] 2023-02-10T17:07:08Z jordi fita mas # Add relation for invoice product