将db_index = True添加到已经包含大量数据的Django模型中

时间:2017-04-12 10:24:50

标签: python django django-models

我想通过添加 <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Created with Keyshape --> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 320 240" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" style="white-space: pre;"> <path d="M9.984,-11.04L12.336,-11.04C12.9227,-11.04,13.2267,-10.736,13.248,-10.128L13.68,0L11.376,0L11.008,-9.136L10.736,-9.136L9.072,-2.304C8.96533,-1.78133,8.63467,-1.52,8.08,-1.52L6.48,-1.52C5.92533,-1.52,5.59467,-1.78133,5.488,-2.304L3.808,-9.136L3.536,-9.136L3.216,0L0.912,0L1.312,-10.128C1.344,-10.736,1.648,-11.04,2.224,-11.04L4.576,-11.04C5.09867,-11.04,5.41867,-10.7787,5.536,-10.256L6.88,-4.752C6.96533,-4.4,7.06133,-3.88267,7.168,-3.2L7.376,-3.2C7.38667,-3.25333,7.42667,-3.472,7.496,-3.856C7.56533,-4.24,7.62133,-4.53867,7.664,-4.752L8.992,-10.256C9.12,-10.7787,9.45067,-11.04,9.984,-11.04Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M15.5381,-7.728L15.7621,-6.128C17.1061,-6.21333,18.2155,-6.256,19.0901,-6.256C19.5915,-6.256,19.9301,-6.18667,20.1061,-6.048C20.2821,-5.90933,20.3755,-5.63733,20.3861,-5.232L20.3861,-4.88L17.5701,-4.88C16.8128,-4.88,16.2208,-4.704,15.7941,-4.352C15.3675,-4,15.1541,-3.50933,15.1541,-2.88L15.1541,-2.08C15.1541,-1.36533,15.3941,-0.808,15.8741,-0.408C16.3541,-0.008,16.9728,0.192,17.7301,0.192C18.8821,0.192,19.8528,-0.272,20.6421,-1.2L20.8821,0L22.7541,0L22.7541,-5.216C22.7541,-6.28267,22.5035,-7.032,22.0021,-7.464C21.5008,-7.896,20.7168,-8.112,19.6501,-8.112C18.3275,-8.112,16.9568,-7.984,15.5381,-7.728ZM17.4901,-2.4L17.4901,-2.704C17.4901,-3.19467,17.7461,-3.44533,18.2581,-3.456L20.3861,-3.456L20.3861,-2.352C19.7141,-1.84,19.0581,-1.584,18.4181,-1.584C17.7995,-1.584,17.4901,-1.856,17.4901,-2.4Z" fill="#ffffff" stroke="none" fill-rule="evenodd" transform="translate(91,115.6)"/> <path id="_a0" d="M27.0163,-11.2L27.0163,-8.464C27.0163,-7.92,26.9683,-7.37067,26.8722,-6.816C27.9709,-7.68,29.0483,-8.112,30.1042,-8.112C30.8189,-8.112,31.3656,-7.92533,31.7443,-7.552C32.1229,-7.17867,32.3122,-6.63467,32.3122,-5.92L32.3122,0L29.9603,0L29.9603,-5.184C29.9603,-5.536,29.9043,-5.77867,29.7922,-5.912C29.6803,-6.04533,29.4803,-6.112,29.1922,-6.112C28.6269,-6.112,27.8962,-5.872,27.0002,-5.392L27.0002,0L24.6322,0L24.6322,-11.2Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a1" d="M34.1944,-7.728L34.4184,-6.128C35.7624,-6.21333,36.8717,-6.256,37.7464,-6.256C38.2477,-6.256,38.5864,-6.18667,38.7624,-6.048C38.9384,-5.90933,39.0317,-5.63733,39.0424,-5.232L39.0424,-4.88L36.2264,-4.88C35.469,-4.88,34.877,-4.704,34.4504,-4.352C34.0237,-4,33.8104,-3.50933,33.8104,-2.88L33.8104,-2.08C33.8104,-1.36533,34.0504,-0.808,34.5304,-0.408C35.0104,-0.008,35.629,0.192,36.3864,0.192C37.5384,0.192,38.509,-0.272,39.2984,-1.2L39.5384,0L41.4104,0L41.4104,-5.216C41.4104,-6.28267,41.1597,-7.032,40.6584,-7.464C40.157,-7.896,39.373,-8.112,38.3064,-8.112C36.9837,-8.112,35.613,-7.984,34.1944,-7.728ZM36.1464,-2.4L36.1464,-2.704C36.1464,-3.19467,36.4024,-3.44533,36.9144,-3.456L39.0424,-3.456L39.0424,-2.352C38.3704,-1.84,37.7144,-1.584,37.0744,-1.584C36.4557,-1.584,36.1464,-1.856,36.1464,-2.4Z" fill="#ffffff" stroke="none" fill-rule="evenodd" transform="translate(91,115.6)"/> <path d="M46.8725,-3.312L46.7765,-3.312L44.9045,0L42.4725,0L44.9045,-4.048L42.6485,-7.888L45.0645,-7.888L46.7445,-4.848L46.9045,-4.848L48.5845,-7.888L51.0005,-7.888L48.7445,-4.048L51.1765,0L48.7445,0Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M64.7965,-11.04L67.1485,-11.04C67.7352,-11.04,68.0392,-10.736,68.0605,-10.128L68.4925,0L66.1885,0L65.8205,-9.136L65.5485,-9.136L63.8845,-2.304C63.7778,-1.78133,63.4472,-1.52,62.8925,-1.52L61.2925,-1.52C60.7378,-1.52,60.4072,-1.78133,60.3005,-2.304L58.6205,-9.136L58.3485,-9.136L58.0285,0L55.7245,0L56.1245,-10.128C56.1565,-10.736,56.4605,-11.04,57.0365,-11.04L59.3885,-11.04C59.9112,-11.04,60.2312,-10.7787,60.3485,-10.256L61.6925,-4.752C61.7778,-4.4,61.8738,-3.88267,61.9805,-3.2L62.1885,-3.2C62.1992,-3.25333,62.2392,-3.472,62.3085,-3.856C62.3778,-4.24,62.4338,-4.53867,62.4765,-4.752L63.8045,-10.256C63.9325,-10.7787,64.2632,-11.04,64.7965,-11.04Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M77.8546,-7.888L77.8546,0L75.9826,0L75.8066,-1.088C74.7186,-0.224,73.6306,0.208,72.5426,0.208C71.06,0.208,70.3186,-0.522667,70.3186,-1.984L70.3186,-7.888L72.6866,-7.888L72.6866,-2.704C72.676,-2.36267,72.7346,-2.12267,72.8626,-1.984C72.9906,-1.84533,73.2146,-1.776,73.5346,-1.776C73.9933,-1.776,74.6493,-1.99467,75.5026,-2.432L75.5026,-7.888Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a2" d="M84.0281,-4.176L81.8041,-4.96C80.9828,-5.25867,80.3961,-5.664,80.0441,-6.176C79.6921,-6.688,79.5161,-7.36,79.5161,-8.192C79.5161,-9.408,79.8121,-10.2213,80.4041,-10.632C80.9961,-11.0427,82.0388,-11.248,83.5321,-11.248C84.9401,-11.248,86.1508,-11.104,87.1641,-10.816L87.0041,-9.152C86.0761,-9.184,84.9241,-9.2,83.5481,-9.2C82.9081,-9.2,82.4815,-9.144,82.2681,-9.032C82.0548,-8.92,81.9481,-8.64,81.9481,-8.192C81.9481,-7.82933,82.0281,-7.568,82.1881,-7.408C82.3481,-7.248,82.6521,-7.09333,83.1001,-6.944L85.1961,-6.224C86.0495,-5.92533,86.6521,-5.51733,87.0041,-5C87.3561,-4.48267,87.5321,-3.808,87.5321,-2.976C87.5321,-1.73867,87.2335,-0.898667,86.6361,-0.456C86.0388,-0.0133333,84.9721,0.208,83.4361,0.208C82.1881,0.208,80.9241,0.0693333,79.6441,-0.208L79.7881,-1.968C82.0601,-1.91467,83.2761,-1.888,83.4361,-1.888C84.0868,-1.888,84.5215,-1.95733,84.7401,-2.096C84.9588,-2.23467,85.0681,-2.52267,85.0681,-2.96C85.0681,-3.33333,84.9935,-3.59733,84.8441,-3.752C84.6948,-3.90667,84.4228,-4.048,84.0281,-4.176Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M92.1105,-6.304L92.1105,-2.576C92.1105,-2.27733,92.1745,-2.06933,92.3025,-1.952C92.4305,-1.83467,92.6545,-1.776,92.9745,-1.776L93.9825,-1.776L94.2385,-0.128C93.6305,0.0853333,92.8892,0.192,92.0145,0.192C91.2998,0.192,90.7452,-0.008,90.3505,-0.408C89.9558,-0.808,89.7585,-1.36533,89.7585,-2.08L89.7585,-6.304L88.3665,-6.304L88.3665,-7.808L89.7585,-7.888L89.7585,-10.096L92.1105,-10.096L92.1105,-7.888L94.3025,-7.888L94.3025,-6.304Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M97.7926,-3.152L100.641,-3.152C101.483,-3.152,102.094,-3.336,102.473,-3.704C102.851,-4.072,103.041,-4.624,103.041,-5.36C103.03,-6.288,102.731,-6.97867,102.145,-7.432C101.558,-7.88533,100.609,-8.112,99.2966,-8.112C97.846,-8.112,96.814,-7.80267,96.2006,-7.184C95.5873,-6.56533,95.2806,-5.48267,95.2806,-3.936C95.2806,-2.464,95.5953,-1.408,96.2246,-0.768C96.854,-0.128,97.91,0.192,99.3926,0.192C100.865,0.192,102.011,-0.00533333,102.833,-0.4L102.609,-1.872C101.489,-1.75467,100.507,-1.696,99.6646,-1.696C99.0353,-1.696,98.5846,-1.79467,98.3126,-1.992C98.0406,-2.18933,97.8673,-2.576,97.7926,-3.152ZM99.9846,-4.576L97.7446,-4.576C97.7766,-5.30133,97.9046,-5.784,98.1286,-6.024C98.3526,-6.264,98.7686,-6.384,99.3766,-6.384C99.8886,-6.384,100.241,-6.312,100.433,-6.168C100.625,-6.024,100.721,-5.76533,100.721,-5.392C100.721,-5.12533,100.67,-4.92267,100.569,-4.784C100.467,-4.64533,100.273,-4.576,99.9846,-4.576Z" fill="#ffffff" stroke="none" fill-rule="evenodd" transform="translate(91,115.6)"/> <path d="M110.234,-8.112L109.994,-5.92L109.354,-5.92C108.831,-5.92,108.026,-5.73867,106.938,-5.376L106.938,0L104.57,0L104.57,-7.888L106.41,-7.888L106.618,-6.736C107.695,-7.65333,108.762,-8.112,109.818,-8.112Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M113.255,-7.888L113.415,-6.736C114.417,-7.65333,115.42,-8.112,116.423,-8.112C117.489,-8.112,118.167,-7.68533,118.455,-6.832C119.383,-7.68533,120.343,-8.112,121.335,-8.112C122.049,-8.112,122.593,-7.92533,122.967,-7.552C123.34,-7.17867,123.527,-6.63467,123.527,-5.92L123.527,0L121.175,0L121.175,-5.184C121.175,-5.52533,121.116,-5.76533,120.999,-5.904C120.881,-6.04267,120.663,-6.112,120.343,-6.112C120.087,-6.112,119.841,-6.064,119.607,-5.968C119.372,-5.872,119.031,-5.68533,118.583,-5.408L118.583,0L116.311,0L116.311,-5.184C116.311,-5.52533,116.244,-5.76533,116.111,-5.904C115.977,-6.04267,115.761,-6.112,115.463,-6.112C115.047,-6.112,114.465,-5.88267,113.719,-5.424L113.719,0L111.367,0L111.367,-7.888Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a3" d="M127.878,-9.28L127.109,-9.28C126.757,-9.28,126.581,-9.456,126.581,-9.808L126.581,-10.736C126.581,-11.088,126.757,-11.264,127.109,-11.264L127.878,-11.264C128.23,-11.264,128.406,-11.088,128.406,-10.736L128.406,-9.808C128.406,-9.456,128.23,-9.28,127.878,-9.28Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a4" d="M130.79,-9.28L130.021,-9.28C129.669,-9.28,129.493,-9.456,129.493,-9.808L129.493,-10.736C129.493,-11.088,129.669,-11.264,130.021,-11.264L130.79,-11.264C131.142,-11.264,131.318,-11.088,131.318,-10.736L131.318,-9.808C131.318,-9.456,131.142,-9.28,130.79,-9.28Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a5" d="M125.397,-7.728L125.621,-6.128C126.965,-6.21333,128.075,-6.256,128.949,-6.256C129.451,-6.256,129.79,-6.18667,129.965,-6.048C130.141,-5.90933,130.235,-5.63733,130.245,-5.232L130.245,-4.88L127.429,-4.88C126.672,-4.88,126.08,-4.704,125.654,-4.352C125.227,-4,125.013,-3.50933,125.013,-2.88L125.013,-2.08C125.013,-1.36533,125.253,-0.808,125.733,-0.408C126.213,-0.008,126.832,0.192,127.59,0.192C128.742,0.192,129.712,-0.272,130.501,-1.2L130.742,0L132.613,0L132.613,-5.216C132.613,-6.28267,132.363,-7.032,131.861,-7.464C131.36,-7.896,130.576,-8.112,129.51,-8.112C128.187,-8.112,126.816,-7.984,125.397,-7.728ZM127.35,-2.4L127.35,-2.704C127.35,-3.19467,127.605,-3.44533,128.117,-3.456L130.245,-3.456L130.245,-2.352C129.574,-1.84,128.918,-1.584,128.277,-1.584C127.659,-1.584,127.35,-1.856,127.35,-2.4Z" fill="#ffffff" stroke="none" fill-rule="evenodd" transform="translate(91,115.6)"/> <path d="M136.412,-7.888L136.588,-6.72C137.729,-7.648,138.854,-8.112,139.964,-8.112C140.678,-8.112,141.225,-7.92533,141.604,-7.552C141.982,-7.17867,142.172,-6.63467,142.172,-5.92L142.172,0L139.82,0L139.82,-5.184C139.82,-5.536,139.764,-5.77867,139.652,-5.912C139.54,-6.04533,139.34,-6.112,139.052,-6.112C138.55,-6.112,137.82,-5.872,136.86,-5.392L136.86,0L134.492,0L134.492,-7.888Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path d="M145.99,-7.888L146.166,-6.72C147.307,-7.648,148.432,-8.112,149.542,-8.112C150.256,-8.112,150.803,-7.92533,151.182,-7.552C151.56,-7.17867,151.75,-6.63467,151.75,-5.92L151.75,0L149.398,0L149.398,-5.184C149.398,-5.536,149.342,-5.77867,149.23,-5.912C149.118,-6.04533,148.918,-6.112,148.63,-6.112C148.128,-6.112,147.398,-5.872,146.438,-5.392L146.438,0L144.07,0L144.07,-7.888Z" fill="#ffffff" stroke="none" transform="translate(91,115.6)"/> <path id="_a6" d="M0,0L7,0" stroke="#dbfe32" fill="none" stroke-linecap="square" opacity="0" transform="translate(116,118.64)"/> <path id="_a7" d="M0,0L7,0" stroke="#dbfe32" fill="none" stroke-linecap="square" opacity="0" transform="translate(125.294,118.64)"/> <path id="_a8" d="M0,0L7,0" stroke="#dbfe32" fill="none" stroke-linecap="square" opacity="0" transform="translate(171.5,118.64)"/> <path id="_a9" d="M0,0L7,0" stroke="#dbfe32" fill="none" stroke-linecap="square" opacity="0" transform="translate(216.147,118.64)"/> <path id="_a10" d="M87.0383,84.5262L83.5894,81.0771L86.05,79.6556C86.2421,79.5445,86.3541,79.3334,86.338,79.112C86.3221,78.8905,86.1811,78.6976,85.9748,78.6154L75.0023,74.2385C74.7871,74.1526,74.5416,74.2032,74.3777,74.3669C74.2139,74.5308,74.1634,74.7763,74.2492,74.9914L78.6255,85.9653C78.7077,86.1713,78.9006,86.3125,79.1221,86.3286C79.3436,86.3447,79.5547,86.2325,79.6657,86.0403L81.0869,83.5798L84.5357,87.0289C84.6442,87.1377,84.7918,87.1986,84.9456,87.1986C85.0993,87.1986,85.2465,87.1377,85.3552,87.0289L87.0383,85.3457C87.2645,85.1194,87.2645,84.7524,87.0383,84.5262ZM84.9456,85.7995L81.3724,82.2262C81.263,82.1168,81.1154,82.0563,80.9628,82.0563C80.9377,82.0563,80.9123,82.058,80.8872,82.0614C80.7084,82.0848,80.5509,82.1901,80.4608,82.3462L79.2596,84.4259L75.8255,75.815L84.4358,79.2495L82.3556,80.451C82.1995,80.5411,82.0944,80.6986,82.0708,80.8773C82.0474,81.0558,82.1081,81.2353,82.2356,81.3626L85.8088,84.936Z" fill="#000000" opacity="0" transform="translate(-161.988,-162.359) translate(206.78,206.802)"/> <script><![CDATA[var ids=['_a0','_a1','_a2','_a3','_a4','_a5','_a6','_a7','_a8','_a9','_a10'];var anims=[[[16,0,600,[0,500,600],[16777215,16777215,14417458],[[-3,1],[-3,1],[-3,1]]]],[[16,0,900,[0,800,900],[16777215,16777215,14417458],[[-3,1],[-1],[-3,1]]]],[[16,0,2100,[0,2000,2100],[16777215,16777215,14417458],[[-3,1],[-3,1],[-3,1]]]],[[16,0,2900,[0,2800,2900],[16777215,16777215,14417458],[[-3,1],[-3,1],[-3,1]]]],[[16,0,2900,[0,2800,2900],[16777215,16777215,14417458],[[-3,1],[-3,1],[-3,1]]]],[[16,0,2900,[0,2800,2900],[16777215,16777215,14417458],[[-3,1],[-3,1],[-3,1]]]],[[8,0,600,[0,500,600],[0,0,1]]],[[8,0,1000,[0,500,600,700,1000],[0,0,0,0,1]]],[[8,0,2200,[0,500,600,2000,2200],[0,0,0,0,1]]],[[8,0,2900,[0,500,600,2800,2900],[0,0,0,0,1]]],[[1,600,2700,[0,400,1100,1500,2000,2300,2500,2700],[-161.988,-150.988,-150.988,-105.988,-105.988,-60.9876,-60.9876,-33.9876]],[2,600,2700,[0,400,1100,1500,2000,2300,2500,2700],[-162.359,-162.359,-162.359,-162.359,-162.359,-162.359,-162.359,-160.999]],[1,206.78],[2,206.802],[8,0,3200,[0,500,600,3100,3200],[0,0,1,1,0]]]];var end=3300;var t="- translate translate scale scale skewX skewY rotate opacity stroke-opacity fill-opacity stroke-width stroke-miterlimit stroke-dasharray stroke-dashoffset stroke fill d".split(" "),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,2,4]; (function(){function v(){0>q&&(q=(new Date).getTime());for(var c=(new Date).getTime()-q+x,a,e=r.length,d=0;d<e;++d){for(var b=r[d],g="",k=anims[d].length,m=0;m<k;++m){var f=anims[d][m],h=f[0];if(2==f.length)a=f[1];else{a=f[1];var l=f[3].length,n=f[3][l-1];a=c<=a?f[4][0]:0<=f[2]&&c>=a+f[2]?0!=n&&f[2]%n?w(f[2]%n,f):f[4][l-1]:w((c-a)%n,f)}0==h?(a=a*f[7]/100,h=f[6].getPointAtLength(a),g+="translate("+h.x+","+h.y+") ",f[8]&&(a?a=f[6].getPointAtLength(a-.001):(a=h,h=f[6].getPointAtLength(.001)),g+="rotate("+ 180*Math.atan2(h.y-a.y,h.x-a.x)/Math.PI+") ")):7>=h?(f=t[h]+"(",f=3>h?f+(h&1?a+",0":"0,"+a):5>h?f+(h&1?a+",1":"1,"+a):f+a,g+=f+") "):(f=b,l=t[h],h=y(u[h],a),f.getAttribute("id"),f.setAttribute(l,h))}""!=g&&(b.getAttribute("id"),b.setAttribute("transform",g))}(0>end||c<end)&&p(v)}function m(c){return 0<=c?Math.pow(c,1/3):-Math.pow(-c,1/3)}function z(c,a,e,d){if(0==c)return 0==a?a=-d/e:(c=Math.sqrt(e*e-4*a*d),d=(-e+c)/(2*a),0<=d&&1>=d?a=d:(d=(-e-c)/(2*a),a=0<=d&&1>=d?d:0)),a;var b=e/c-a*a/(c*c)/3;e= a*a*a/(c*c*c)/13.5-a*e/(c*c)/3+d/c;var g=e*e/4+b*b*b/27;a=-a/(3*c);if(0>=g)if(b||e){c=Math.sqrt(e*e/4-g);d=Math.acos(-e/2/c);e=Math.cos(d/3);d=Math.sqrt(3)*Math.sin(d/3);c=m(c);b=2*c*e+a;if(0<=b&&1>=b)return b;b=-c*(e+d)+a;if(0<=b&&1>=b)return b;b=c*(d-e)+a;if(0<=b&&1>=b)return b}else return-m(d/c);else{c=m(-e/2+Math.sqrt(g));e=m(-e/2-Math.sqrt(g));d=c+e+a;if(0<=d&&1>=d)return d;d=-(c+e)/2+a;if(0<=d&&1>=d)return d}return 0}function y(c,a){if(2==c&&"number"===typeof a)return"#"+("000000"+a.toString(16)).substr(-6); if(3==c)return a.join(",");if(4==c){for(var e="",d=a.length,b=0;b<d;)if(0==a[b])e+="M"+a[b+1]+","+a[b+2],b+=3;else if(1==a[b])e+="L"+a[b+1]+","+a[b+2],b+=3;else if(2==a[b])e+="C"+a[b+1]+","+a[b+2]+","+a[b+3]+","+a[b+4]+","+a[b+5]+","+a[b+6],b+=7;else if(3==a[b])e+="Z",b+=1;else break;return e}return a}function A(c,a,e,d){if(0==c)return(e-a)*d+a;if(1==c)return 1>d?a:e;if(2==c){if("number"===typeof a&&"number"===typeof e){c=1-d;var b;return c*(a>>16)+d*(e>>16)<<16|c*(a>>8&255)+d*(e>>8&255)<<8|c*(a& 255)+d*(e&255)}return 1>d?a:e}if(3==c){0==a.length&&(a=[0]);0==e.length&&(e=[0]);c=a.length;a.length!=e.length&&(c=a.length*e.length);for(var g=Array(c),k=0;k<c;++k)b=a[k%a.length],b=(e[k%e.length]-b)*d+b,0>b&&(b=0),g[k]=b;return g}if(4==c){c=a.length;g=Array(c);for(k=0;k<c;++k)g[k]=(e[k]-a[k])*d+a[k];return g}return 0}function w(c,a){var e;a:{e=a[3].length;for(var d=0;d<e;++d)if(c<a[3][d]){e=d;break a}--e}var d=a[3][e-1],b=(c-d)/(a[3][e]-d);if(5<a.length&&a[5].length>e-1)if(d=a[5][e-1],0<=d[0])if(0>= b)b=0;else if(1<=b)b=1;else var g=d[0],k=d[2],b=z(3*g-3*k+1,-6*g+3*k,3*g,-b),b=3*b*(1-b)*(1-b)*d[1]+3*b*b*(1-b)*d[3]+b*b*b;else-1!=d[0]&&(-2==d[0]?b=Math.ceil(b):-3==d[0]&&(b=Math.floor(b)));return A(u[a[0]],a[4][e-1],a[4][e],b)}var p=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null;p||(p=function(c){window.setTimeout(c,16)});for(var x=0,q=-1,r=Array(ids.length),l=0;l<ids.length;++l)r[l]= document.getElementById(ids[l]);anims.forEach(function(c){if(0==c[0][0]){var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",c[0][6]);c[0][8]=" "==c[0][6].charAt(0);c[0][7]=a.getTotalLength();c[0][6]=a}});p(v)})(); ]]></script> </svg> 为现有的Django模型字段添加索引。相应的表已经在数据库中有很多数据。在使用新更改迁移后,是否会向字段添加db_index = True会自动为值编制索引吗?

1 个答案:

答案 0 :(得分:0)

理想情况下,是的。这将在你的sql表中创建一个索引。因此,无论何时运行migrations,您的表都会添加索引。

如果您想尝试对其进行硬编码,可以在迁移脚本中添加前向方法。它可能看起来像这样

db.execute("CREATE INDEX my_index on table_name(col_name)", params=[])