Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6608833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:39:06+00:00 2026-05-25T19:39:06+00:00

I have a site which needs one admin-editable integer. It has no association to

  • 0

I have a site which needs one admin-editable integer. It has no association to any other model or attribute in the database. It’s literally a flat integer, between 1-10,000, that the admin (who is the only user) needs access to edit.

My question relates to database design. Surely the most efficient way to do this isn’t to create its own table, with just one single column and one single row?

In short…one single field, no associations: how should I best roll that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:39:06+00:00Added an answer on May 25, 2026 at 7:39 pm

    It depends on how you define “efficient”.

    If you define “efficient” as using

    • a single storage mechanism for all user-editable data (a database),
    • a single security mechanism for all user-editable data (SQL GRANT and REVOKE), and
    • a single constraint mechanism for all user-editable data (SQL DDL),

    then creating a one-row table probably is the most efficient. Something along these lines might work on the database side.

    create table admin_editable_integer (
      restrictive_key integer primary key,
      the_integer integer not null,
      -- Allow only one row.
      check (restrictive_key = 1),
      -- Restrict the range of integers.
      check (the_integer between 1 and 10000)
    );
    
    revoke all on admin_editable_integer from public;
    grant select, insert, update on admin_editable_integer to admin;
    

    I don’t think rails supports CHECK constraints, so I think you’ll need to pass ALTER TABLE SQL statements in the migration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pulling my hair out on this one. I have a site which is
I have this classic ASP site which has been working fine until we updated
I have several admin instances running on a site - one for each country,
I have received a content export of a MOSS 2007 site which I need
I am relatively new to mod_rewrite, but have a site which I would like
I have a c# site which makes use of a lot of images with
I have a web site which I download 2-3 MB of raw data from
I have inherited a client site which crashes every 3 or 4 days. It
I have a custom site definition which includes a form library. I have a
We're looking at doing a MOSS 2007 site which will have a fairly dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.