Search Postgresql Archives

Re: Function PostgreSQL 9.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Information. eg.:

The schema for the tables.

Why is not just adding a DEFAULT value to the users.code not an option?



The customer can add their own value to the users.code column.
That's why I can't have a default value. 

 
What the default code should be or how it is to be calculated?

the default value is 1000.

So the customer can set their own code value. But if they don't do that, I've to provide the next available value. 1001, 1002, 1003, etc....

 

What is increment_client_code?

It's a column: 
 
ALTER TABLE public.companies ADD COLUMN client_code_increment integer;
ALTER TABLE public.companies ALTER COLUMN client_code_increment SET DEFAULT 1000;

 

Does increment_client_code relate to users or some other table, say clients?


nope.. there is no link between them



table users:
CREATE TABLE
    users
    (
        id INTEGER DEFAULT nextval('users_id_seq'::regclass) NOT NULL,
        email CHARACTER VARYING DEFAULT ''::CHARACTER VARYING NOT NULL,
        encrypted_password CHARACTER VARYING DEFAULT ''::CHARACTER VARYING NOT NULL,
        reset_password_token CHARACTER VARYING,
        reset_password_sent_at TIMESTAMP(6) WITHOUT TIME ZONE,
        remember_created_at TIMESTAMP(6) WITHOUT TIME ZONE,
        sign_in_count INTEGER DEFAULT 0 NOT NULL,
        current_sign_in_at TIMESTAMP(6) WITHOUT TIME ZONE,
        last_sign_in_at TIMESTAMP(6) WITHOUT TIME ZONE,
        current_sign_in_ip INET,
        last_sign_in_ip INET,
        created_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL,
        updated_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL,
        name CHARACTER VARYING,
        confirmation_token CHARACTER VARYING,
        confirmed_at TIMESTAMP(6) WITHOUT TIME ZONE,
        confirmation_sent_at TIMESTAMP(6) WITHOUT TIME ZONE,
        company_name CHARACTER VARYING,
        country CHARACTER VARYING,
        mobile_number CHARACTER VARYING,
        landline_number CHARACTER VARYING,
        staff_colour CHARACTER VARYING,
        company_id INTEGER,
        role_id INTEGER,
        active BOOLEAN DEFAULT false,
        deleted BOOLEAN DEFAULT false,
        avatar_file_name CHARACTER VARYING,
        avatar_content_type CHARACTER VARYING,
        avatar_file_size INTEGER,
        avatar_updated_at TIMESTAMP(6) WITHOUT TIME ZONE,
        fax CHARACTER VARYING,
        website CHARACTER VARYING,
        business_type CHARACTER VARYING,
        lead_source CHARACTER VARYING,
        code CHARACTER VARYING,
        notes TEXT,
        status CHARACTER VARYING,
        tsv TSVECTOR,
        origin CHARACTER VARYING,
        origin_id CHARACTER VARYING,
        first_name CHARACTER VARYING,
        last_name CHARACTER VARYING,
        billed_client_id INTEGER,
        username CHARACTER VARYING,
        is_client BOOLEAN DEFAULT false,
        job_share BOOLEAN DEFAULT true
    ); 

Table companies:
CREATE TABLE
    companies
    (
        id INTEGER DEFAULT nextval('companies_id_seq'::regclass) NOT NULL,
        name CHARACTER VARYING,
        country CHARACTER VARYING,
        timezone CHARACTER VARYING,
        mobile_number CHARACTER VARYING,
        email CHARACTER VARYING,
        website CHARACTER VARYING,
        phone CHARACTER VARYING,
        created_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL,
        updated_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL,
        reference_increment INTEGER DEFAULT 1000,
        activated BOOLEAN DEFAULT true,
        enable_quotes BOOLEAN DEFAULT false,
        allow_billing_client BOOLEAN DEFAULT true,
        allow_templates_recurrence BOOLEAN DEFAULT true,
        recurrence_limit INTEGER DEFAULT 30,
        job_title_dropdown BOOLEAN DEFAULT false,
        default_reference_prefix CHARACTER VARYING,
        default_reference_increment INTEGER,
        default_visit_start_day INTEGER,
        default_visit_start_hour INTEGER,
        default_visit_start_min INTEGER,
        job_date_entry_duration BOOLEAN DEFAULT true,
        default_visit_duration_hour INTEGER DEFAULT 0,
        default_visit_duration_min INTEGER DEFAULT 30,
        date_entry_short BOOLEAN DEFAULT true,
        time_entry_24 BOOLEAN DEFAULT true,
        time_field_increment INTEGER DEFAULT 10,
        enable_job_share BOOLEAN DEFAULT true,
        token CHARACTER VARYING
    );


 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux